专注云计算教学
新手上云第一站

在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

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

  1. [base]
  2. name=CentOS-$releasever – Base
  3. failovermethod=priority
  4. baseurl=http://vault.centos.org/5.11/os/$basearch/
  5. gpgcheck=1
  6. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
  7. http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
  8. #released updates
  9. [updates]
  10. name=CentOS-$releasever – Updates
  11. failovermethod=priority
  12. baseurl=http://vault.centos.org/5.11/updates/$basearch/
  13.         http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
  14. gpgcheck=1
  15. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
  16. http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
  17. #additional packages that may be useful
  18. [extras]
  19. name=CentOS-$releasever – Extras
  20. failovermethod=priority
  21. baseurl=http://vault.centos.org/5.11/extras/$basearch/
  22.         http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
  23. gpgcheck=1
  24. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
  25. http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
  26. #additional packages that extend functionality of existing packages
  27. [centosplus]
  28. name=CentOS-$releasever – Plus
  29. failovermethod=priority
  30. baseurl=http://vault.centos.org/5.11/centosplus/$basearch/
  31.         http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
  32. gpgcheck=1
  33. enabled=0
  34. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
  35. http://mirrors.aliyuncs.com/centos/RPM-GPG-KEY-CentOS-5
  36. #contrib – packages by Centos Users
  37. [contrib]
  38. name=CentOS-$releasever – Contrib
  39. failovermethod=priority
  40. baseurl=http://vault.centos.org/5.11/contrib/$basearch/
  41.         http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
  42. gpgcheck=1
  43. enabled=0
  44. gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5
  45. 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

赞(7)
未经允许不得转载:WM云建站 » 在CentOS 5里使用 vault.centos.org 作为yum源

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址