關(guān)于RHEL和CentOS 5(或6)版本yum更新源的解決問題

說明:此測(cè)試環(huán)境用Red Hat Enterprise Linux 5.4 作為測(cè)試機(jī),同理,本文理論上可以解決關(guān)于RHEL和CentOS 5版本甚至6版本的yum更新源的問題(其他版本未測(cè)試)

推薦使用鏡像源服務(wù)器網(wǎng)站:http://vault.centos.org/

問題描述:

1、RHEL的YUM源需要注冊(cè)用戶才能更新使用,由于CentOS和RHEL基本沒有區(qū)別,并且CentOS已經(jīng)被REHL收購(gòu)。所以將RHEL的YUM源替換為CentOS即可

2、CentOS 5 在2017-03-31日已經(jīng)結(jié)束支持,不再提供維護(hù)更新,所以包括阿里云鏡像站的文件可能都是過時(shí)或已經(jīng)有部分文件缺失

環(huán)境:Red Hat Enterprise Linux 5.4

解決方法:

1.清除原有RHEL的YUM及相關(guān)軟件包。

~]#? rpm -qa | grep yum | xargs rpm -e --nodeps

~]#? rpm -qa |grep python-urlgrabber|xargs rpm -e --nodeps

檢查yum是否刪除干凈

~]#rpm -qa |grep yum?

2.備份或只保留/etc/yum.repos.d/rhel-debuginfo.repo,其他.repo文件都刪掉,這里我選擇備份

~]# cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak

3.將RHEL的yum源更換同版本的CentOS的yum源,修改baseurl和gpgkey為目標(biāo)鏡像服務(wù)器

baseurl=http://vault.centos.org/5.4/os/i386/

gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5

原RHEL的yum源:

修改為CentOS的yum源:

4.在安裝yum前,先下載相應(yīng)的rpm包

~]# wget http://vault.centos.org/5.4/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm

~]# wget http://vault.centos.org/5.4/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

~]# wget http://vault.centos.org/5.4/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm

~]# wget http://vault.centos.org/5.4/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

5.安裝yum軟件包

~]# rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm

~]# rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

~]# rpm -ivh yum-3.2.22-20.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

第三條命令一次安裝兩個(gè)rpm文件,因?yàn)樗麄兇嬖谝蕾囮P(guān)系,不在一起的話會(huì)安裝失敗。

6.更換yum源,使用http://vault.centos.org/作為更新源

將其中的baseurl中的$releasever之前部分替換成相應(yīng)歷史源站地址和版本號(hào)

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.? You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

name=CentOS-$releasever - Base - 163.com

baseurl=http://vault.centos.org/5.4/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

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

#released updates

[updates]

name=CentOS-$releasever - Updates - 163.com

baseurl=http://vault.centos.org/5.4/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

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

#packages used/produced in the build but not released

[addons]

name=CentOS-$releasever - Addons - 163.com

baseurl=http://vault.centos.org/5.4/addons/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons

gpgcheck=1

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

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - 163.com

baseurl=http://vault.centos.org/5.4/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

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

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - 163.com

baseurl=http://vault.centos.org/5.4/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

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

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib - 163.com

baseurl=http://vault.centos.org/5.4/contrib/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

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

7.確認(rèn)在 /etc/yum.repos.d/目錄沒有除了CentOS-Base.repo之外其他以repo結(jié)尾的文件,有的話刪除或做備份處理

8.yum更新和啟用更新源

~]# yum clean all

~]# yum makecache

過程出現(xiàn)time out 超時(shí)尋找其他mirror鏡像源,報(bào)錯(cuò),基本是下載資源和網(wǎng)速問題,可以退出安裝重新yum makecache

出現(xiàn)yum.pid報(bào)錯(cuò),刪掉重新makecache

~]# rm -r /var/run/yum.pid

~]# yun makecache

9.安裝完成,測(cè)試驗(yàn)證

~]# yum install telnet-server

"""

以上僅憑回憶操作所記,有問題后續(xù)測(cè)試更新

"""

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • 1)備份原有的默認(rèn)yum源 [root@bastion-IDC ~]# cp /etc/yum.repos.d/C...
    SkTj閱讀 1,073評(píng)論 0 0
  • 由于Redhat的yum在線更新是收費(fèi)的,如果沒有注冊(cè)的話是不能使用的,即不能在線安裝軟件。在這種情況下,想使用R...
    ahohoho閱讀 1,140評(píng)論 2 5
  • 服務(wù)器相關(guān)配置 1.系統(tǒng)為:linux Centos6.5 2.用戶為: root 3.硬盤為: 大...
    IT_小白閱讀 1,656評(píng)論 0 2
  • Linux程序包的管理需要依賴程序包管理工具,程序包管理工具可以實(shí)現(xiàn)程序的安裝、升級(jí)、卸載、查詢和校驗(yàn),等等相關(guān)操...
    piziyang12138閱讀 934評(píng)論 0 0
  • 沒有記錄就沒有發(fā)生,沒有反思就沒有成長(zhǎng),沒有行動(dòng)就沒有進(jìn)步。 【學(xué)習(xí)成長(zhǎng)】 1,本周開啟主題營(yíng)活動(dòng),每天一場(chǎng)精彩分...
    閨蜜叫我老王閱讀 163評(píng)論 0 0