HoganHost blog

[email protected]

Could not resolve host: mirrorlist.centos.org on CentOS 7

 

Are you encountering the frustrating error message “Could not resolve host: mirrorlist.centos.org” while trying to update or install packages on your CentOS 7 system? This error typically occurs when your system is unable to connect to the CentOS mirrorlist server to fetch package information. But worry not, as we have compiled a comprehensive guide to help you troubleshoot and resolve this issue quickly.

Understanding the Problem

Before diving into solutions, it’s essential to understand why this error occurs. When you run commands like yum or dnf to install or update packages on CentOS, your system tries to connect to mirrorlist.centos.org to fetch a list of mirrors from which it can download packages. If your system cannot resolve the hostname “mirrorlist.centos.org” to an IP address, it will fail to connect and display the error message.

Solutions

Here are several troubleshooting steps you can take to resolve the “Could not resolve host: mirrorlist.centos.org” error:

Check Network Connectivity: Ensure that your system has a working internet connection. Try accessing other websites or pinging mirrorlist.centos.org to verify connectivity. If you’re behind a firewall or proxy, make sure it’s configured correctly to allow access to external sites.

Verify DNS Configuration: The error could be due to DNS resolution issues. Check your system’s DNS configuration by examining the /etc/resolv.conf file. Ensure that it contains valid DNS server addresses, such as those provided by your ISP or a public DNS service like Google DNS (8.8.8.8, 8.8.4.4) or Cloudflare DNS (1.1.1.1, 1.0.0.1).

cat /etc/resolv.conf

Temporary Workaround: As a temporary workaround, you can edit the /etc/hosts file to manually map the hostname “mirrorlist.centos.org” to an IP address. Open the file using a text editor like nano or vim and add the following line:

151.101.36.133 mirrorlist.centos.org

Save the file and try running your yum or dnf commands again.

Flush DNS Cache: Sometimes, DNS cache can cause issues. Flush the DNS cache on your system to clear any stale entries. Run the following command to flush the DNS cache:

 

sudo systemd-resolve --flush-caches

Restart Network Services: Restart the network services on your CentOS system to apply any changes made to the network configuration. Use the following commands to restart the network service:

sudo systemctl restart NetworkManager

Check Firewall Settings: Ensure that your firewall is not blocking outgoing connections to mirrorlist.centos.org. Adjust your firewall settings to allow access to the CentOS mirrorlist server.

Conclusion

By following the steps outlined in this guide, you should be able to troubleshoot and resolve the “Could not resolve host: mirrorlist.centos.org” error on your CentOS 7 system. Remember to systematically go through each solution until you find the one that works for you. If the problem persists, don’t hesitate to seek further assistance from online forums, communities, or CentOS support channels.

Check out our cheap and reliable web hosting hoganhost.com.ng

Leave a Comment

Your email address will not be published. Required fields are marked *