解决centos 6.6 更换yum 163源报错
一般百度更换163yum源,都是如下操作:
mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.old
cd/etc/yum.repos.d/
wgetwget
mvCentOS6-Base-163.repoCentOS-Base.repo
yumcleanall&yum makecache
但在 yum makecache报错:http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
尝试其他镜像。错误:Cannot retrieve repository Metadata (repomd.xml) for repository: base. Please verify its path and try again
这是因为无法访问http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml,repomd.xml 在http://mirrors.163.com/centos/6-6.5下已经不存在,需要更改CentOS-Base.repo此文件中的$releasever参数,而$releasever来源于rpm -qi centos-release 的version数值 。
centos6.X一般取值为6,因此报错。
更正操作为
vi CentOS-Base.repo
替换掉releasever :$s/$releasever/6.6/g
替换掉后已经可以yum makecache 了
转载地址:http://www.centoscn.com/CentosBug/osbug/2015/0813/5996.html