How Do You Troubleshoot Yum Commands Not Working with the Error “Could Not Resolve Host: Unknown Error”?

Problem scenario:  Yum commands to install packages are not working.  When you use "yum install coolpackage" you get an error like this:

' [Errno 14] curl#6 - "Could not resolve host:; Unknown error"
Trying other mirror. [Errno 14] curl#6 - "Could not resolve host:; Unknown error"
Trying other mirror.

 One of the configured repositories failed (Docker Repository),

failure: repodata/repomd.xml from dockerrepo: [Errno 256] No more mirrors to try. [Errno 14] curl#6 - "Could not resolve host:; Unknown error"

You cannot use curl or wget properly.  You try this command (with no quotes):  "curl"

But you get this error:  "curl: (6) Could not resolve host:; Unknown error"

What do you do?

Root cause: DNS resolution is not working for your Internet connectivity.  You must configure a DNS server for your network interface.

1.  cd /etc/sysconfig/network-scripts

2.  Backup the interface file that governs the IP address with the default gateway.  If you are not sure which file this is, follow these directions. For a standard CentOS 7.x server, the file will be ifcfg-enp0s3 file.  Once this file is backed up,  modify the original one.

3.  Make sure these two stanzas exist in the file that governs the default gateway:


For example, the last four lines of this file /etc/sysconfig/network-scripts/ifcfg-enp0s3 may look like this:


Save the changes. 

4.  Run this command:  service network restart

​5.  Now there should be no problem.

Leave a comment

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