One of our reader sent us the below question.
Question: I have CentOS 4.9 installed on my PC and thought of upgrading it using yum command. But when I executed ‘yum update”, it throwed the below error message:
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: base
I’m new to Linux, so couldn’t figure out a solution. I’m a regular visitor of techglimpse and would like to know if you can help me with this issue. Also a tutorial about this on your website would help a newbie like me…
Thanks.
Ramesh
Solution: yum access the repository (that are configured in /etc/yum.conf) file over the internet to install, remove and update one or more rpm-based software packages. In your case, a CentOS repository has been configured by default during the OS installation. When ‘yum update’ command is run, it tries to connect to ‘mirrorlist.centos.org’, but failed during name resolution. It means, your machine is not configured with DNS.
To configure DNS on your Linux machine, follow the below steps.
- vim /etc/resolv.conf
- Add the below line
nameserver 8.8.8.8
- Save the file and exit
Note: It’s always advised to add more than one nameserver – Primary and secondary. Here ‘8.8.8.8‘ is the Google’s public nameserver. You may change that to the nameserver of your ISP or even OpenDNS (208.67.222.222, 208.67.220.220)
So, the /etc/resolv.conf file may contain below nameserver entries…
nameserver 8.8.8.8 nameserver 208.67.222.222 nameserver 208.67.220.220
Once done, try yum update and it should work fine. Hope this helps you.
Thank you. Resolved my problem!! very simple to do it.