rhel6.5 如何配置使用阿里云网络yum源

1、备份原有repo文件

点击(此处)折叠或打开

  1. 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的版本

点击(此处)折叠或打开

  1. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

3、运行yum makecache生成缓存,但是在rhel6.5中使用阿里云的centos mirrors 遇到问题,

点击(此处)折叠或打开

  1. Loaded plugins: product-id, security, subscription-manager
  2. This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
  3. 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,保存

点击(此处)折叠或打开

  1. sed -i 's/\$releasever/6/' CentOS-Base.repo
还有一个更加完善的方式,在所有mirrorlist前面加上#,并所有$releasever替换成6

点击(此处)折叠或打开

  1. sed -i '/mirrorlist/d' CentOS-Base.repo
  2. sed -i 's/\$releasever/6/' CentOS-Base.repo
  3. sed -i '/\[addons\]/,/^$/d' CentOS-Base.repo
  4. sed-i 's/RPM-GPG-KEY-CentOS-5/RPM-GPG-KEY-CentOS-6/' CentOS-Base.repo

4.清理并重新生成yum缓存

点击(此处)折叠或打开

  1. yum clean metadata
  2. 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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值