If you’re managing CentOS 7 servers, you might have encountered a frustrating issue recently: repository failures due to the server reaching its End of Life (EOL) stage. This commonly manifests with errors like:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Name or service not known"

This error indicates that the default CentOS 7 repositories are no longer accessible due to the distribution’s EOL status. Fortunately, there’s a straightforward fix to get your servers back on track.

Step-by-Step Fix

Follow these steps to resolve the CentOS 7 repository issue:

  1. Comment out Mirrorlist and Update Base URL:Open a terminal session on your CentOS 7 server and run the following commands:
    sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
    sed -i 's|#\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
    

    These commands will comment out the mirrorlist URLs and update the base URLs to point to the vault.centos.org repository, which hosts CentOS archives after EOL.

  2. Run the Fix Script:Now, execute the fix script provided by Systron to automate the base repository update:
    curl -s -L https://systron.net/blog/wp-content/uploads/2024/07/centos7-repo-fix.sh | bash
    

    This script will automatically adjust the base repository URLs to use the vault.centos.org archive, ensuring that your CentOS 7 server can fetch packages and updates without encountering the mirrorlist error.

Why Vault.CentOS.org?

The vault.centos.org repository serves as an archive for older versions of CentOS after they reach EOL. It’s maintained by the CentOS community and provides a reliable source for accessing packages and updates for unsupported versions like CentOS 7.

Conclusion

By following these steps, you can effectively resolve the mirrorlist error on CentOS 7 servers affected by the EOL repository issue. This fix ensures that your systems remain secure and operational by redirecting package requests to the appropriate archive repository.

For ongoing management of CentOS servers, staying proactive about EOL dates and transitioning to supported distributions like CentOS Stream or alternatives such as CentOS 8 or AlmaLinux is recommended. You can order a Dedicated server or VPS with AlmaLinux with us.

Stay tuned for more updates and solutions to common server management issues at Systron Micronix. If you have any questions or feedback, feel free to leave a comment below. Happy server administration!

Note: Always ensure the integrity and security of scripts downloaded from the internet before executing them on your system.