You may receive a problem with yum not being able to resolve hosts when you try to install a yum package.

This error generally occurs while installing Apache web server in Linux environment.

 

[root@localhost ~]# yum install httpd 

Loaded plugins: fastestmirror, langpacks Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os 

error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; No address associated with hostname" 

 

This happens when the server can’t connect to the Internet because of can’t resolve to name server.

 

What to do next ?

 

Go to /etc/resolv.conf and have a look

 

[root@localhost ~]# vi /etc/resolv.conf

nameserver 8.8.8.8

 

Write “search yourdomain” at bottom, so it look something like below

 

nameserver 8.8.8.8

search yourdomain

 

Save the quit the file and try installing again.

 

Cette réponse était-elle pertinente? 29 Utilisateurs l'ont trouvée utile (117 Votes)