在CentOS 5里使用 vault.centos.org 作为yum源

云友“alifanss”在问答里说使用CentOS 5 的系统,无法用yum来安装应用软件。

原因:CentOS 5 在2017-03-31日已经结束支持,不再提供维护更新,所以包括阿里云镜像站的文件可能都是过时或已经有部分文件缺失。

环境:CentOS 5.11 32位。

过程:

1.登录到系统,运行 yum update ,会提示:

http://mirrors.aliyuncs.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found 
Trying other mirror. 
http://mirrors.aliyun.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found 
Trying other mirror. 
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again 

bbs-aliyun-dongshan3-312530-1.png

2.编辑文件 /etc/yum.repos.d/CentOS-Base.repo ,将其中的 mirrors.aliyun.com/centos/$releasever 替换成相应历史源站地址和版本号,如 vault.centos.org/5.11

[base]
name=CentOS-$releasever - Base
failovermethod=priority
baseurl=http://vault.centos.org/5.11/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-$releasever - Updates
failovermethod=priority
baseurl=http://vault.centos.org/5.11/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
failovermethod=priority
baseurl=http://vault.centos.org/5.11/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
failovermethod=priority
baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
failovermethod=priority
baseurl=http://vault.centos.org/5.11/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5

bbs-aliyun-dongshan3-312530-2.png

3.之后,可继续 yum update 了
bbs-aliyun-dongshan3-312530-3.png

4.也可以安装其它软件了,如 yum install httpd
bbs-aliyun-dongshan3-312530-4.png

参考:

标签: none

添加新评论