开发者社区> 问答> 正文

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

dongshan8 2017-04-11 12:08:01 10554
云友“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







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




3.  之后,可继续 yum update 了



4. 也可以安装其它软件了,如 yum install httpd



参考:

1. yum fails - https://www.centos.org/forums/viewtopic.php?t=62106
2. Using Vault Repositories - https://www.centos.org/forums/viewtopic.php?t=36628
Linux
分享到
取消 提交回答
全部回答(8)
  • 杨哥爱程序
    2018-10-31 10:12:26
    Re在CentOS 5里使用 vault.centos.org 作为yum源
    感谢分享,辛苦了
    0 0
  • 服务器云
    2018-10-12 22:21:28

    阿里云的镜像也不行么?
    0 0
  • 我的那个神
    2018-10-11 22:15:49
    Re在CentOS 5里使用 vault.centos.org 作为yum源
    0 0
  • 发展融通
    2018-10-08 10:15:52
    Re在CentOS 5里使用 vault.centos.org 作为yum源
    按照上述方法后,没有成功呢
    0 0
  • 夏乘风
    2018-09-21 21:24:44
    Re在CentOS 5里使用 vault.centos.org 作为yum源
    这个源现在用不了了,还有可以用的源吗
    0 0
滑动查看更多

集结各类场景实战经验,助你开发运维畅行无忧

推荐文章
相似问题
推荐课程