CentOS 6: fix yum after end of life
Make yum work again on end-of-life CentOS 6 by pointing the repositories to the CentOS Vault, including the archived EPEL and SCL repositories.
CentOS 6 reached end of life and its official update repositories were removed from the main mirrors. On a stock system yum upgrade therefore fails. The fix is to point yum at the CentOS Vault, which keeps the last 6.x release (6.10) available.
Symptoms
Setting up Upgrade Process
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base.
Certificate errors
If yum also reports certificate problems, update the CA bundle first:
sudo yum install ca-certificates
sudo yum update ca-certificates
sudo yum update curl
Use the CentOS Vault repositories
Replace the content of /etc/yum.repos.d/CentOS-Base.repo with the Vault configuration:
[C6.10-base]
name=CentOS-6.10 - Base
baseurl=http://vault.epel.cloud/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-updates]
name=CentOS-6.10 - Updates
baseurl=http://vault.epel.cloud/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-extras]
name=CentOS-6.10 - Extras
baseurl=http://vault.epel.cloud/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-contrib]
name=CentOS-6.10 - Contrib
baseurl=http://vault.epel.cloud/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
[C6.10-centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://vault.epel.cloud/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
After this, yum upgrade works again, and the system can be brought up to 6.10 even if it is on an earlier 6.x release.
EPEL and SCL repositories
The EPEL and Software Collections (SCLo) repositories were removed as well. Ready-made repository files for the archived versions are available from a third-party site:
curl https://www.getpagespeed.com/files/centos6-epel-eol.repo --output /etc/yum.repos.d/epel.repo
sudo yum -y install centos-release-scl
sudo curl https://www.getpagespeed.com/files/centos6-scl-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl.repo
sudo curl https://www.getpagespeed.com/files/centos6-scl-rh-eol.repo --output /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
For EPEL, the GPG key can be downloaded from the archive and stored locally:
cd /etc/pki/rpm-gpg
wget https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL
Notes
- Disabling GPG checks (
yum install --nogpgcheck <package>) is a workaround of last resort. Do not use it on a production system. - CentOS 6 no longer receives security updates. Plan a migration to a supported release; the repositories above only keep
yumworking. - Oracle Linux 6 can also be used as a local source. See the Oracle Linux 6 documentation on creating repositories.
- Background and the original procedure: CentOS 6 new repo URL after EOL (gcore) and the CentOS Vault.