如何使用一个老旧的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

你可能感兴趣的:(实用技术)