2019獨角獸企業重金招聘Python工程師標準>>>
1.為什么要替換
redhat系統使用yum命令安裝軟件時會出現This system is not registered with RHN. RHN support will be disabled. 原因是redhat的yum安裝軟件需要注冊,是收費的。而centos的yum源是免費的。這時就需要替換掉當前的yum,換成centos的yum
2.替換前準備
明確當前系統的版本,比如我的是redhat 7。為什么要明確當前系統的版本,因為yum軟件需要依賴其他軟件,而其他軟件往往都是已經在當前系統上安裝過的。當你替換centos版本的yum時,很可能centos的yum所依賴的軟件版本不匹配,到那時就麻煩了。我們不可能根據提示,將當前系統已經安裝的其他軟件都一 一卸載,然后換成centos yum依賴的其他的軟件,這樣太費事。
下面注意點,是實際得出來的。
1.明確當前的python版本。redhat7默認的python版本是2.6 ?centos6.5和centos6.5的依賴的python版本也是2.6 ?centos7依賴的python版本是2.7
2.找準當前系統對應的centos的相關軟件,原則之一就是盡量少的替換當前系統的軟件。此時我只需要替換相關的yum軟件包,其他的軟件包盡量少替換。
3. ?redhat 7-->可以替換centos6.5 和centos6.8版本的yum軟件
3.替換步驟
3.1.查看redhat當前的yum相關包
? ? rpm -qa | grep yum
3.2 .刪除yum相關包
? ? rpm -e yum --nodeps
3.3.下載centos相關yum包-
-yum包的安裝依賴python,可以根據系統當前python版本決定安裝centos版本的yum包
從http://mirrors.163.com/centos/7/os/x86_64/Packages下載 依賴pythoon2.7版本
http://mirrors.163.com/centos/6.8/os/x86_64/Packages/ 下載對應centos6.8版本的
根據下面列出的rpm下載即可,版本可能有些許差別
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-utils-1.1.30-37.el6.noarch.rpm
yum-updateonboot-1.1.30-37.el6.noarch.rpm
yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
yum-3.2.29-73.el6.centos.noarch.rpm?
需要的依賴:python-urlgrabber-3.9.1-11.el6.noarch.rpm ?我的系統已經存在python-urlgrabber-3.9.1-9.el6.noarch,但是版本太低
需要卸載 然后安裝3.9.1-11版本
rpm -e --nodeps python-urlgrabber-3.9.1-9.el6.noarch
pm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm?
4.安裝下載下來的yum包
rpm -ivh yum-*
報錯大部分原因是依賴的版本問題。當前系統版本太低,如果依賴的版本太低的rpm很多,建議選擇centos版本相對低寫的yum相關包
----安裝報錯
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
?? ?python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
3.5.配置/ect/yum.resp.d/CentOS-Base.repo:注,如果用的是6.5版本的,將6.8全部替換成6.5即可
[base]
name=CentOS-6.8 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6.8/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.8&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates?
[updates]
name=CentOS-6.8 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.8/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.8&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful
[extras]
name=CentOS-6.8 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6.8/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.8&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.8 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6.8/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.8&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users
[contrib]
name=CentOS-6.8 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6.8/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.8&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
?