How To Fix PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org'”

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

Today we will teach you how to fix PYCURL ERROR 6 – “Couldn’t resolve host ‘mirrorlist.centos.org'”. This issue is most commonly encountered when trying to run the yum update command on a CentOS based distro with the following error log:

$ yum update
-----------------------------------------------------------
Loading mirror speeds from cached hostfile
Error: Cannot find a valid baseurl for repo: base
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os&infra=stock error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
-----------------------------------------------------------

How to Fix It

To fix the error is quite easy, we just need to add Google Public DNS as a DNS resolver in the /etc/resolv.conf file. Add the following variables at the very bottom line of the /etc/resolv.conf file.

nameserver 8.8.8.8
nameserver 8.8.4.4

Then please try to reboot your server and run the system update command once again using the following command:

$ yum update

Leave a Comment