关于旧版CentOS(5.0以下)无法执行yum install的问题

前端之家收集整理的这篇文章主要介绍了关于旧版CentOS(5.0以下)无法执行yum install的问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
转载地址:http://blog.chinaunix.net/uid-20731487-id-3504282.html

由于种种原因,比如需要一直延用过去构筑的系统,或者是为了模拟旧版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呢?我们从这里得到了启示。http://mirror.centos.org/centos/4.9/readme 
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:

http://vault.centos.org/4.9/

对,http://vault.centos.org/还提供旧版的升级,所以我们必须修改配置文件(/etc/yum.repos.d/CentOS-Base.rpeo)来定向到这个镜像站点方法如下


  1. --- /etc/yum.repos.d/CentOS-Base.repo.orig@H_403_27@
  2. +++ /etc/yum.repos.d/CentOS-Base.repo@H_403_27@
  3. @@ -13,8 +13,9 @@@H_403_27@

  4. @H_403_27@
  5. [base]@H_403_27@
  6. name=CentOS-$releasever - Base@H_403_27@
  7. -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os@H_403_27@
  8. +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os@H_403_27@
  9. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/@H_403_27@
  10. +baseurl=http://vault.centos.org/4.9/os/$basearch/@H_403_27@
  11. gpgcheck=1@H_403_27@
  12. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4@H_403_27@
  13. priority=1@H_403_27@
  14. @@ -23,8 +24,9 @@@H_403_27@
  15. #released updates@H_403_27@
  16. [update]@H_403_27@
  17. name=CentOS-$releasever - Updates@H_403_27@
  18. -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates@H_403_27@
  19. +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates@H_403_27@
  20. #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/@H_403_27@
  21. +baseurl=http://vault.centos.org/4.9/updates/$basearch/@H_403_27@
  22. gpgcheck=1@H_403_27@
  23. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4@H_403_27@
  24. priority=1@H_403_27@
  25. @@ -33,8 +35,9 @@@H_403_27@
  26. #packages used/produced in the build but not released@H_403_27@
  27. [addons]@H_403_27@
  28. name=CentOS-$releasever - Addons@H_403_27@
  29. -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons@H_403_27@
  30. +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons@H_403_27@
  31. #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/@H_403_27@
  32. +baseurl=http://vault.centos.org/4.9/addons/$basearch/@H_403_27@
  33. gpgcheck=1@H_403_27@
  34. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4@H_403_27@
  35. priority=1@H_403_27@
  36. @@ -43,8 +46,9 @@@H_403_27@
  37. #additional packages that may be useful@H_403_27@
  38. [extras]@H_403_27@
  39. name=CentOS-$releasever - Extras@H_403_27@
  40. -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras@H_403_27@
  41. +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras@H_403_27@
  42. #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/@H_403_27@
  43. +baseurl=http://vault.centos.org/4.9/extras/$basearch/@H_403_27@
  44. gpgcheck=1@H_403_27@
  45. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4@H_403_27@
  46. priority=1@H_403_27@
  47. @@ -53,8 +57,9 @@@H_403_27@
  48. #additional packages that extend functionality of existing packages@H_403_27@
  49. [centosplus]@H_403_27@
  50. name=CentOS-$releasever - Plus@H_403_27@
  51. -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus@H_403_27@
  52. +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus@H_403_27@
  53. #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/@H_403_27@
  54. +baseurl=http://vault.centos.org/4.9/centosplus/$basearch/@H_403_27@
  55. gpgcheck=1@H_403_27@
  56. enabled=0@H_403_27@
  57. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4@H_403_27@
  58. @@ -64,8 +69,9 @@@H_403_27@
  59. #contrib - packages by Centos Users@H_403_27@
  60. [contrib]@H_403_27@
  61. name=CentOS-$releasever - Contrib@H_403_27@
  62. -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib@H_403_27@
  63. +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib@H_403_27@
  64. #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/@H_403_27@
  65. +baseurl=http://vault.centos.org/4.9/contrib/$basearch/@H_403_27@
  66. gpgcheck=1@H_403_27@
  67. enabled=0@H_403_27@
  68. gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4@H_403_27@
这样一来我们可以正常使用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吧 

猜你在找的CentOS相关文章