Wednesday, November 4, 2009

Yum error: Cannot find a valid baseurl for repo: with CentOS

If you encounter the error " Error: Cannot find a valid baseurl for repo: ". There are a few possible steps which might fix as least for myself

Step 1: You may want to uncomment the baseurl for the repo
# cd /etc/yum.repos.d
# vim CentOS-Base.repo
-----------------------------
baseurl=..................
-----------------------------
(and all other repo you are using)
# yum clean all
# yum check-update

Step 2: If you are still getting error "Cannot open/read repomd.xml file for repository: epel", it could be due to the resolving of DNS or you have set the proxy wrongly at /etc/yum.conf
# wget the http://download.fedoraproject.org/pub/epel/4/i386/repodata/repomd.xml (or other url in the repo)
(If you encountered error information like "Name or Service not known". It is likely a DNS resolution issues)

# vim /etc/resolv.conf
(and resolve the error)

Step 3: If you are still encountering error, you may want to check /etc/yum.conf and comment out proxy
# vim /etc/yum.conf
--------------------
# proxy=xxxxxxx
--------------------
Finally do a unset to remove a http proxy  
# unset http_proxy
# echo $http_proxy (To check)

Step 4: If you are still encountering error, you may finally want to check /etc/profile.d/. Maybe there is a proxy script there.

No comments: