1. 程式人生 > >yum源失效問題 網易 阿里等國內映象失效

yum源失效問題 網易 阿里等國內映象失效

yum源失效修正

問題背景:需要搭建git伺服器 需要用到yum install ,發現yum源失效 理所當然的去使用以往方案解決

step1: 備份原CentOS-Base.repo 檔案

   mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
   wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

step3:

   yum clean all
   yum makecache

報錯:

這裡寫圖片描述

This directory (and version of CentOS) is depreciated.  

CentOS-5 is now past EOL

You can get the last released version of centos 5.11 here:

http://vault.centos.org/5.11/

Please NOTE:  this is not being maintained for security since moving to Vault.
It will have security issues, you should upgrade to a new version instead.

這裡寫圖片描述
我修改完成之後還是報404錯誤,結果是由於 $releasever 的值是5,而我的版本是5.11,所以我直接將變數 $releasever 全域性替換為5.11,至此問題解決了.
可以利用命令

rpm -qi centos-release

檢視$releasever的值
這裡寫圖片描述

更新:在給網友解決的時候一直報錯,查到原因是他有兩個yum源,關閉失效的yum源即可,附修改完的yum源截圖,如果是6系統還需要修改gpgkey這個後的值為

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

這裡寫圖片描述