一般更换163yum源,都是如下操作:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old
cd /etc/yum.repos.d/
wget wget spacer.gifhttp://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo
yum clean all & 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 :1,s/$releasever/6.6/g
替换掉后已经可以yum makecache 了
本文出自 “boyhack” 博客,请务必保留此出处http://461205160.blog.51cto.com/274918/1739813
原文地址:http://461205160.blog.51cto.com/274918/1739813