CentOS: Fixing PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org'” on yum update

Operating System, Technology

Problem:

Found this problem on Centos 6.4 x86_64 :
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: base

Solution:

And I tried to fix it by these steps:
1. edit network interface. For my case, I used eth0 in CentOS 6.X:
vim /etc/sysconfig/network-scripts/ifcfg-eth0
In CentOS 7.X you can use the ensxxx interface.

2. update NM_CONTROLLED to no
ONBOOT=no
NM_CONTROLLED=no
BOOTPROTO=dhcp
DNS1=8.8.8.8
DNS2=4.2.2.2

3. restart the network interface
ifdown eth0
ifup eth0

Hope this help

Leave a Reply

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