First, go to the yum source configuration directory.
Cd/etc/yum. repos. d
Yum source of the Backup System
Mv CentOS-Base.repo CentOS-Base.repo.save
# Cd/etc/yum. repos. d/
# Wget http://mirrors.163.com/.help/CentOS-Base-163.repo
Copy code
4. Use
# Vi CentOS-Base-163.repo
Add # before all the uploadlists and replace all $ releasever with 5. Save // note that this step is very important. If you replace it with another one, it may not work properly.
5. Clear and regenerate the yum Cache
# Yum clean metadata
# Yum makecache
Copy code
6. Then yum will work normally, and update it as soon as possible.
# Yum-y upgrade
7. If the installation is GPG key retrieval failed: [Errno 5] OSError: [Errno 2] No such file or directory: '/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5' error, this is because the checksum key is not installed, execute the following command.
Wget http://mirrors.163.com/centos/5/ OS /x86_64/RPM-GPG-KEY-CentOS-5
Rpm -- import RPM-GPG-KEY-CentOS-5 &&