RHEL6.5 移植使用CentOS 的YUM 步驟

問題:使用 Red Hat Enterprise Linux Server(RHEL) yum安裝軟件時顯示 This system is not registered with RHN. RHN support will be disabled. node

緣由:python

Red Hat Enterprise Linux Server(RHEL) 的yum服務是付費的,由於沒有付費,因此沒法使用yum安裝軟件,如RHEL想安裝YUM,一種可行的辦法是移植使用CentOS的YUM。centos

解決方法:緩存

步驟一:卸載RHELyum,並下載CentOS的對應軟件包less

執行:rpm -qa|grep yum|xargs rpm -e --nodeps  將yum卸載掉this

cat /etc/issue && uname -a 看一下系統版本號和系統位數url

 

到 http://mirrors.kernel.org/centos/ 或 http://mirrors.163.com/centos/ 找對應系統版本號ip

 

若是系統是5.* 64位,則打開http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/
若是系統是5.* 32位,則打開http://mirrors.kernel.org/centos/5/os/i386/CentOS/
若是系統是6.* 64位:http://mirrors.kernel.org/centos/6/os/x86_64/Packages/
若是系統是6.* 32位:http://mirrors.kernel.org/centos/6/os/i386/Packages/rem

 

下載的文件包括:文檔

python-iniparse-0.3.1-2.1.el6.noarch.rpm

python-urlgrabber-3.9.1-11.el6.noarch.rpm

yum-3.2.29-73.el6.centos.noarch.rpm

yum-metadata-parser-1.1.2-16.el6.i686.rpm

yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

 

步驟二:安裝CentOS的對應軟件包

安裝步驟:

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 

rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm 

 

這一步可能出以下錯誤

warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

Preparing...                ########################################### [100%]

file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-8.el6.noarch

file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-8.el6.noarch

file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-8.el6.noarch

file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-8.el6.noarch

file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-8.el6.noarch

 

緣由是包衝突,須要卸載原有的urlgrabber包:

[root@rchen98]# rpm -qa |grep urlgrabber

python-urlgrabber-3.9.1-8.el6.noarch

 

[root@rchen98]# rpm -e python-urlgrabber-3.9.1-8.el6.noarch

而後再安裝。

 

而後安裝yum

rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm 

 

 

步驟三:生成yum.repos.d文件

http://mirrors.163.com的 centos幫助文檔 中下載CentOS6-Base-163.repo文件,存放到/etc/yum.repos.d中

#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

更名爲:CentOS6-Base.repo

 

而後把文件裏的$releasever都改成你的Linux版本(6或者5),也就是文件修改爲以下便可:

# 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-6 - Base - 163.com

baseurl=http://mirrors.163.com/centos/6/os/$basearch/

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

gpgcheck=1

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

#released updates

[updates]

name=CentOS-6 - Updates - 163.com

baseurl=http://mirrors.163.com/centos/6/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&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 - Extras - 163.com

baseurl=http://mirrors.163.com/centos/6/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&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 - Plus - 163.com

baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=6&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 - Contrib - 163.com

baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/

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

gpgcheck=1

enabled=0

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

 

步驟四:重建緩存

yum clean all 清除原有緩存

yum makecache  獲取yum列表

等待,大約三分鐘後出現下面提示,表示yum更改完成:

Metadata Cache Created

相關文章
相關標籤/搜索