
How to Fix yum After CentOS 7 Went EOL
Fix CentOS 7 yum repository errors after EOL by switching to vault repositories or the AlmaLinux EL7 mirror.
Overview
CentOS 7 is end of life, so the original mirror list can return 404 errors when you run yum update or install packages. The fix is to point yum to archived CentOS 7.9 repositories, or use a maintained EL7-compatible repository file.
Option 1: Use the CentOS vault repositories
Open the repository file:
sudo nano /etc/yum.repos.d/CentOS-Base.repo
or
vi /etc/yum.repos.d/CentOS-Base.repo
Replace the main sections with the CentOS 7.9 vault URLs:
[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/7.9.2009/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/7.9.2009/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/7.9.2009/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/7.9.2009/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/7.9.2009/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Option 2: Use the AlmaLinux EL7 repository file
If you still get HTTP 404 errors, replace the CentOS repository file with the EL7-compatible file from AlmaLinux:
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://el7.repo.almalinux.org/centos/CentOS-Base.repo
Clean yum cache and test
sudo yum clean all
sudo yum makecache
sudo yum update
If the server is internet-facing, plan a migration away from CentOS 7 as soon as possible. EOL systems no longer receive normal security updates.


