今天用centos6.2时,出现错误:
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/$releasever

而/etc/yum.repos.d下的*.repo源文件中都是baseurl都是带变量的
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
所以yum去尝试读取xml文件自然失败了。


 # wget http://mirrors.163.com/centos/%releasever/os/x86_64/repodata/repomd.xml
--2013-01-24 10:50:10--  http://mirrors.163.com/centos/%releasever/os/x86_64/repodata/repomd.xml
Resolving mirrors.163.com... 123.58.173.89, 123.58.173.106
Connecting to mirrors.163.com|123.58.173.89|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2013-01-24 10:50:11 ERROR 404: Not Found.
所以需要修改*.repo源文件中将$releasever变量全替换成6即可正常yum了。