Could not resolve host: mirrorlist.centos.org Centos 7

Solution 1:

Could not resolve host: mirrorlist.centos.org; Unknown error

This indicates that you either (a) don't have a properly configured DNS server or (b) your network configuration isn't correct and you can't connect to a DNS server to check the hostname mirrorlist.centos.org.

Try using ping 8.8.8.8. If this fails, try ping <local-gateway-ip>. If that also fails, your local network configuration is wrong and you'll have to check the configuration.

If you can ping 8.8.8.8, try using host, nslookup or dig to check the DNS settings like host google.com or dig google.com. If these fail, you need to check your DNS settings. Check /etc/resolv.conf to see what's configured.

UPDATE

Since /etc/resolv.conf is blank, you need to setup a DNS resolver. I would suggest entering the following into the file using nano or vi (or whatever your comfortable using):

nameserver 9.9.9.9

Save this file, then try yum update again.

You can also try other DNS hosts if you would rather, such as 8.8.8.8 or 8.8.4.4 or any of the OpenDNS hosts.

Solution 2:

You may have a connectivity issue somewhere, here a small process to check where you have an issue.

Basic Connectivity

Check if the server has internet (ip address and correct route - if not working, check with ip address if you have an IP address).

 ping 8.8.8.8

Resolver

Check what are the resolver and ping them

 cat /etc/resolv.conf

You should have line with nameserver and an IP address. Check that IP is answering.

 ping xx.xx.xx.xx

Then do an nslookup

 nslookup mirrorlist.centos.org

It should return a list of IP addresses. If not, your DNS server might not working correctly, you can try another server with

 nslookup
 > server 8.8.8.8
 > mirrorlist.centos.org

And check this time it's working as expected.