How to fix yum after CentOS 6 went EOL
yum
upgrades for production use, this is the repository for you.Active subscription is required.
If for whatever reason, you are stuck with the now EOL version of the CentOS operating system, you can no longer run yum upgrade
successfully. Running yum upgrade
in CentOS 6 will yield the following results:
Setting up Upgrade Process
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
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. Please verify its path and try again
Rightfully so, as the YUM repository was removed from the main CentOS update servers, no security or feature upgrades are provided.
However, not all the repositories have halted their support for CentOS 6. The GetPageSpeed repository still provides up-to-date NGINX builds and its module packages.
This may be one reason why you want yum upgrade
to still work. Or simply, you are not ready to move on with a newer operating system, and willing to take the security risks associated with using the older version.
How to fix yum upgrade
then?
Use the CentOS Vault repository
The CentOS Vault repositories have been around for a long time and allow you to stick to a specific CentOS x.y release even while newer ones are available. Now that there will be no newer 6.x, you can simply point your yum
repository configuration to the latest 6.x that will ever be, which is 6.10.
To use the Vault repository, set up its repo configuration instead of the now defunct repositories configuration:
curl https://www.getpagespeed.com/files/centos6-eol.repo --output /etc/yum.repos.d/CentOS-Base.repo
That’s it, everything should be functional.
Alternatively, you can manually replace the contents of the file /etc/yum.repos.d/CentOS-Base.repo
with the necessary configuration.
Copy-paste the entire snippet below and hit Enter:
cat <<-'EOF' > /etc/yum.repos.d/CentOS-Base.repo
[C6.10-base]
name=CentOS-6.10 - Base
baseurl=http://vault.centos.org/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.centos.org/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.centos.org/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.centos.org/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=