Fixing YUM Errors on CentOS 7 After End-of-Life (EOL)
Now that CentOS 7 has officially reached its End-of-Life, updating and installing packages via YUM will fail. This article will guide you on how to reconfigure YUM to continue using the repositories normally.
Important Notice: CentOS 7 End-of-Life
As of June 30, 2024, CentOS 7 has officially reached its End-of-Life (EOL). This means the default repositories have been disabled, causing commands like yum update or yum install to fail with server-not-found errors.
1. What is the Problem?
After the EOL date, when you run YUM commands, you will receive error messages similar to the following:
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: HTTP Error 404 - Not Found
...
One of the configured repositories failed (CentOS-7 - Base),
and yum doesn't have enough cached data to continue.
The reason is that the default mirrorlist and baseurl addresses no longer exist. To fix this, we need to point YUM to the CentOS Vault - the official archive for older CentOS versions.
2. Detailed Step-by-Step Guide
Follow the steps below to reconfigure your .repo files.
- Step 1: Back Up Your Current Configuration Files
Before making any changes, back up your YUM configuration files to be safe. Open your terminal and run the following command:
sudo cp -r /etc/yum.repos.d/ /etc/yum.repos.d.bak - Step 2: Point to the CentOS Vault
We will use the sed command to automatically find and replace the old URLs with the CentOS Vault URL in all configuration files. This action disables the mirrorlist and points the baseurl to the vault repository.
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* - Step 3: Clean and Rebuild the YUM Cache
After changing the configuration, you need to clear the old cache and have YUM create a new one from the Vault repository.
sudo yum clean all
sudo yum makecache - Step 4: Verify and Update
Now, try running the update command again. If everything is successful, you should see a list of packages being downloaded from the vault.centos.org address.
sudo yum updateYour system is now able to update and install packages from the CentOS 7 archive repository.
Recommendation:
Although this fix allows you to continue using CentOS 7, we strongly recommend planning an upgrade to a supported operating system like AlmaLinux or Rocky Linux to ensure you receive critical security patches.