When did this error appear?
After the first of July 2024, CentOS 7 has transitioned to using new Vault archive repositories. This change was implemented to ensure that users have access to older software versions and security updates that are no longer available in the main repositories. The switch to the Vault archive repositories is crucial for maintaining the stability and security of systems running CentOS 7, especially for enterprises and organizations that rely on this operating system for critical operations. By accessing these archives, users can continue to receive important updates and support for their CentOS 7 installations, ensuring their systems remain secure and functional.
How To Fix Could not resolve host: mirrorlist.centos.org
First, you need to know what version of CentOS 7 you are using by this command:
cat /etc/centos-release
then edit the file /etc/yum.repos.d/CentOS-Base.repo (you can use FileZilla if you want)
vi /etc/yum.repos.d/CentOS-Base.repo
after that you should change “7.9.2009” inside this code to your version of CentOS 7 and replace it with your existing one
[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
Everything will work now
yum update
Enjoy your server without problems