CentOS 7 has reached its End of Life (EOL), which means its repositories may no longer be maintained and accessible. However, you can still use some workarounds to keep your CentOS 7 system functional by pointing to alternative or archived repositories.
-
Backup Existing Repo Files:
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
-
Download the Updated Repository File:
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://raw.githubusercontent.com/AtlasGondal/centos7-eol-repo-fix/main/CentOS-Base.repo
-
Clean YUM Cache:
Clear the YUM cache to ensure it fetches the latest repository metadata:
sudo yum clean all sudo yum makecache
-
Update Your System:
Now try updating your system:
sudo yum update
-
Backup Existing Repo Files:
sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
-
Edit the Repository File:
Open the repository file with a text editor:
sudo nano /etc/yum.repos.d/CentOS-Base.repo
-
Update the
baseurl
:Replace the
baseurl
entries with the following 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
Save the file and exit the editor.
-
Clean YUM Cache:
Clear the YUM cache to ensure it fetches the latest repository metadata:
sudo yum clean all sudo yum makecache
-
Update Your System:
Now try updating your system:
sudo yum update