yum "Couldn't resolve host 'mirrorlist.centos.org'" for CentOS 6
时间:2015-08-20 15:41 来源:linux.it.net.cn 作者:IT网
yum "Couldn't resolve host 'mirrorlist.centos.org'" for CentOS 6
I ran into an issue recently where I could ping URL's just fine, but when I ran the "yum update" command yum could not resolve anything. I would get error messages like the following:
[root@viviotech ~]# yum -y update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: baseAfter a bit of digging, and absolutely no help from my friend Google, I asked one of the Vivio technicians about it and he said he'd seen it on other servers - specifically servers with VirtualMin.
Take a look at the resolve.conf file:
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4See how VirtualMin adds the 127.0.0.1 address first? Apparently YUM will ONLY check the very first entry in the /etc/resolve.conf file when it looks for the server to resolve IP Addresses. In this case, the local DNS resolver was not configured to use forwarders, so the YUM process would ask the local DNS server where to find "mirrorlist.centos.org", and when the local resolver didn't know, YUM would simply report an error instead of looking at the other resolvers in the /etc/resolve.conf list. This is why I could ping URL's just fine, but YUM could not find them.
The solution to this was to simply place the 127.0.0.1 entry at the botton of the /etc/resolv.conf file, like so:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 127.0.0.1After that, eveything worked great.
IMPORTANT: The above examples of the /etc/resolv.conf file use the IP Addresses of the Google Public DNS.
(责任编辑:IT)
yum "Couldn't resolve host 'mirrorlist.centos.org'" for CentOS 6I ran into an issue recently where I could ping URL's just fine, but when I ran the "yum update" command yum could not resolve anything. I would get error messages like the following:[root@viviotech ~]# yum -y update Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was 14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'" Error: Cannot find a valid baseurl for repo: baseAfter a bit of digging, and absolutely no help from my friend Google, I asked one of the Vivio technicians about it and he said he'd seen it on other servers - specifically servers with VirtualMin. Take a look at the resolve.conf file: nameserver 127.0.0.1 nameserver 8.8.8.8 nameserver 8.8.4.4See how VirtualMin adds the 127.0.0.1 address first? Apparently YUM will ONLY check the very first entry in the /etc/resolve.conf file when it looks for the server to resolve IP Addresses. In this case, the local DNS resolver was not configured to use forwarders, so the YUM process would ask the local DNS server where to find "mirrorlist.centos.org", and when the local resolver didn't know, YUM would simply report an error instead of looking at the other resolvers in the /etc/resolve.conf list. This is why I could ping URL's just fine, but YUM could not find them. The solution to this was to simply place the 127.0.0.1 entry at the botton of the /etc/resolv.conf file, like so: nameserver 8.8.8.8 nameserver 8.8.4.4 nameserver 127.0.0.1After that, eveything worked great. IMPORTANT: The above examples of the /etc/resolv.conf file use the IP Addresses of the Google Public DNS. |