About the old version of CentOS (under 5.0) cannot execute yum install

Reprint address: http://blog.chinaunix.net/uid-20731487-id-3504282.html

For various reasons, such as the need to continue to use the system built in the past, or to simulate the old version of RedHat Enterprise version (RedHat's paid version, CentOS can be said to be its copycat version), etc., there will be situations where it is necessary to continue to use the old version of CentOS .

However, since the various service images of CentOS almost no longer support the upgrade of the old version of the system, the following problems will be encountered when upgrading 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

Prompt that no support for upgrading can be found. But what if you must continue to use the old version of CenOS? We got inspiration from here. 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/

Yes, http://vault.centos.org/ also provides upgrades to the old version, so we must modify the configuration file (/etc/yum.repos.d/CentOS-Base.rpeo) to be directed to this mirror site. Methods as below


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

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


# 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吧 

Guess you like

Origin blog.csdn.net/dongyu1009/article/details/72598863