如何使用一個老舊的CentOS 5.8系統

    找運維同事要一臺32位Linux服務器,只有CentOS 5.8的鏡像,使用這個老舊系統的第一個挑戰就是要找到Yum源,否則安裝軟件是個難題。

[root@demo yum.repos.d]# yum -y update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

    因爲CentOS 5從2017年起不再被支持,其官方yum源被移動到了http://vault.centos.org,所以需要對其做響應的配置方可使用。打開/etc/yum.repos.d/CentOS-Base.repo,按如下方式修改前幾個地址。如果爲其它版本,如CentOS 5.11,將其中的5.8替換爲5.11即可。

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://vault.centos.org/5.8/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://vault.centos.org/5.8/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://vault.centos.org/5.8/extras/$basearch/

    再來試一下,又可以使用yum安裝或更新軟件啦!

[root@demo yum.repos.d]# yum -y update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                     | 1.1 kB     00:00
base/primary                                             | 967 kB     00:02
base                                                                  2725/2725
extras                                                   | 2.1 kB     00:00
extras/primary_db                                        | 174 kB     00:01
updates                                                  | 1.9 kB     00:00
updates/primary_db                                       | 240 kB     00:02 ...

參考資料

https://unix.stackexchange.com/questions/359902/yum-update-error-on-centos-5-6

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章