To fix the above error, open your terminal or login via ssh or terminal, and run the following commands to change the repo URL to point to vault.centos.org, from the official CentOS repos.
Here we use the sed command to edit the required directives or parameters in the repo configuration files:
# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Alternatively, you can also point to the Cloudflare-based vault repository, by running the following commands:
# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-Linux-*
Now you should be able to update CentOS or install packages without any error: