由于种种原因,比如需要一直延用过去构筑的系统,或者是为了模拟旧版RedHat Enterprise版(RedHat的收费版,CentOS可以说是它的山寨版)等等,会有需要继续使用旧版的CentOS的情况。
但是由于CentOS的各个服务镜像几乎已经不支持旧版系统的升级,升级yum的时候会遇到以下问题。
# yum update
Setting up Update Process
Setting up repositories
not using ftp, http[s], or file for repos, skipping - 4 is not a valid release or hasnt been released yet
Cannot find a valid baseurl for repo: update
Error: Cannot find a valid baseurl for repo: update
提示已经找不到提供升级的支持了。但如果又非要继续使用旧版CenOS呢?我们从这里得到了启示。
This directory (and version of CentOS) is depreciated.
CentOS-4 is now past EOL
You can get the last released version of centos 4.9 here:
对,还提供旧版的升级,所以我们必须修改配置文件(/etc/yum.repos.d/CentOS-Base.rpeo)来定向到这个镜像站点。方法如下
-
--- /etc/yum.repos.d/CentOS-Base.repo.orig
-
+++ /etc/yum.repos.d/CentOS-Base.repo
-
@@ -13,8 +13,9 @@
-
-
[base]
-
name=CentOS-$releasever - Base
-
-mirrorlist=
-
+#mirrorlist=
-
#baseurl=
-
+baseurl=os/$basearch/
-
gpgcheck=1
-
gpgkey=
-
priority=1
-
@@ -23,8 +24,9 @@
-
#released updates
-
[update]
-
name=CentOS-$releasever - Updates
-
-mirrorlist=
-
+#mirrorlist=
-
#baseurl=
-
+baseurl=updates/$basearch/
-
gpgcheck=1
-
gpgkey=
-
priority=1
-
@@ -33,8 +35,9 @@
-
#packages used/produced in the build but not released
-
[addons]
-
name=CentOS-$releasever - Addons
-
-mirrorlist=
-
+#mirrorlist=
-
#baseurl=
-
+baseurl=addons/$basearch/
-
gpgcheck=1
-
gpgkey=
-
priority=1
-
@@ -43,8 +46,9 @@
-
#additional packages that may be useful
-
[extras]
-
name=CentOS-$releasever - Extras
-
-mirrorlist=
-
+#mirrorlist=
-
#baseurl=
-
+baseurl=extras/$basearch/
-
gpgcheck=1
-
gpgkey=
-
priority=1
-
@@ -53,8 +57,9 @@
-
#additional packages that extend functionality of existing packages
-
[centosplus]
-
name=CentOS-$releasever - Plus
-
-mirrorlist=
-
+#mirrorlist=
-
#baseurl=
-
+baseurl=centosplus/$basearch/
-
gpgcheck=1
-
enabled=0
-
gpgkey=
-
@@ -64,8 +69,9 @@
-
#contrib - packages by Centos Users
-
[contrib]
-
name=CentOS-$releasever - Contrib
-
-mirrorlist=
-
+#mirrorlist=
-
#baseurl=
-
+baseurl=contrib/$basearch/
-
gpgcheck=1
-
enabled=0
-
gpgkey=
这样一来我们可以正常使用yum update了。
# yum update
Setting up Update Process
Setting up repositories
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 843 kB 00:01
sqlite cache needs updating, reading in metadata
update : ################################################## 1920/1920
No Packages marked for Update/Obsoletion
CentOS2,3的情况还没有确认过,理论上都行得通。不过嘛,如果没有特殊情况还是升级你的CentOS吧
阅读(1076) | 评论(0) | 转发(0) |