解决CentOS-5 yum无法更新问题

https://blog.csdn.net/lqy461929569/article/details/77837181

公司的一台本地服务器,平时就是拿来当作内部各应用的机器,很少去动它,在装zabbix-agent的时候发现yum无法更新。


   
   
  1. http://mirrors.aliyuncs.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
  2. Trying other mirror.
  3. http://mirrors.aliyun.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
  4. Trying other mirror.
  5. Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again


一开始以为是yum的设置问题,反复设置都是一样。

后来干脆直接换yum源,阿里的源、搜狐的源,都是一样的结果。

用服务器去访问地址是可以访问的

curl http://mirrors.aliyun.com/centos/5/os/i386/repodata/repomd.xml 没有报404
   
   


查了一下,发现 CentOS 5 在2017-03-31日已经结束支持,不再提供维护更新,所以包括阿里镜像站的文件可能都是过时或已经有部分文件缺失。

这样的话只好把yum源的地址切换到目前还能用的: http://vault.centos.org/5.11/ 

cd /etc/yum.repos.d sed -i ‘s/mirrors.aliyun.com\/centos\/ releasever/vault.centos.org\/5.11/gCentOSBase.reposedis/mirrors.aliyuncs.com\/centos\/ r e l e a s e v e r / v a u l t . c e n t o s . o r g \/ 5.11 / g ′ C e n t O S − B a s e . r e p o s e d − i ‘ s / m i r r o r s . a l i y u n c s . c o m \/ c e n t o s \/ releasever/vault.centos.org\/5.11/g’ CentOS-Base.repo


   
   
  1. cd /etc/yum.repos.d
  2. sed -i 's/mirrors.aliyun.com\/centos\/$releasever/vault.centos.org\/5.11/g' CentOS-Base.repo</div></div></li><li><div class="hljs-ln-numbers"><div class="hljs-ln-line hljs-ln-n" data-line-number="3"></div></div><div class="hljs-ln-code"><div class="hljs-ln-line">sed -i 's/mirrors.aliyuncs.com\/centos\/$releasever/vault.centos.org\/5.11/g' CentOS-Base.repo
 
####因为这里替换的内容有 “/” ,所以用 “\” 来转义。

更新一下yum的缓存:


   
   
  1. yum clean all
  2. yum makecache

当然,切换了地址之后的代价也是巨大的




            </div>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值