1、备份原有repo文件
点击(此处)折叠或打开
- mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
在这里使用的6的版本
这时候,我们需要如何解决呢
还有一个更加完善的方式,在所有mirrorlist前面加上#,并所有$releasever替换成6
在这里使用的6的版本
点击(此处)折叠或打开
- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
3、运行yum makecache生成缓存,但是在rhel6.5中使用阿里云的centos mirrors 遇到问题,
点击(此处)折叠或打开
- Loaded plugins: product-id, security, subscription-manager
- This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
- http://mirrors.aliyun.com/centos/6Server/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
修改repo文件 把所有$releasever替换成6,保存
点击(此处)折叠或打开
- sed -i 's/\$releasever/6/' CentOS-Base.repo
点击(此处)折叠或打开
- sed -i '/mirrorlist/d' CentOS-Base.repo
- sed -i 's/\$releasever/6/' CentOS-Base.repo
- sed -i '/\[addons\]/,/^$/d' CentOS-Base.repo
- sed-i 's/RPM-GPG-KEY-CentOS-5/RPM-GPG-KEY-CentOS-6/' CentOS-Base.repo
4.清理并重新生成yum缓存
点击(此处)折叠或打开
- yum clean metadata
- yum makecache
参考博客:
https://help.aliyun.com/knowledge_detail/5980325.html
http://mirrors.aliyun.com/help/centos
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27039319/viewspace-2121691/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27039319/viewspace-2121691/