Zac Rahm

Software Engineer, Systems Administrator, Normal Person

CentOS 5.7 baseurl repo error

This morning I was toying with my install of CentOS on the work server, and I thought I’d share the problem and solution to a yum update related problem I was having.

After running a simple yum update command, I kept getting the error

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os error was
[Errno 4] IOError:
Error: Cannot find a valid baseurl for repo: os

 

The Solution: In my /etc/resolv.conf I needed to add some lines indicating my nameservers. People online report that adding the nameservers “8.8.8.8″ and “8.8.8.4″ help, but I used the DNS given to me by the network admins. The file itself had instructions in the comments, but adding the lines
DNS1 = xxx.xxx.xxx.xx
DNS2 = xxx.xxx.xxx.xx

did nothing. Instead, I added

nameserver xxx.xxx.xxx.xx
nameserver xxx.xxx.xxx.xx

and this did the trick. Obviously, replace the x’s with your nameserver’s IPs.

Once I was done with this, I ran a quick
yum clean all
yum update

and all seems to be in working order. Hope this helps someone who gets a little tired of crawling the CentOS fora!