因爲本身的 RHEL 沒有註冊,所以不能使用自帶的 yum 來升級系統或者安裝軟件。
由於 CentOS 是 RHEL 的完整從新編譯版本(固然要相互對應同樣的版本號),因此 RHEL 是必定能夠用 CentOS 的 yum 源的。 node
一/【刪除 RHEL 自帶的 yum】
# rpm -aq|grep yum|xargs rpm -e –nodeps linux
二/【下載】如下四個文件: centos
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm 緩存
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm ui
上面的文件可能有的已經升級,因此你們能夠去163的鏡像去找相應的rpm url
http://mirrors.163.com/centos/5/os/i386/CentOS/ spa
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm .net
# wget http://mirrors.163.com/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm 資源
若是按照這種下載方式的話 get
我下載第一個的時候自動把第二個下載了,而後下載第三個的時候就下載不了了,不知道爲何,而後換個目錄就能下載了,奇怪啊
安裝新下載的包:
[root@banping centos]# rpm -ivh yum-*
找一個CentOS的包資源配置庫,名爲CentOS-Base.repo,放到/etc/yum.repos.d/路徑:
cd /etc/yum.repos.d/
wget http://www.linuxidc.com/files/2011/05/06/CentOS-Base.repo
生成緩存文件到/var/cache/yum路徑:
[root@banping yum.repos.d]# yum makecache
這樣就能夠使用CentOS的yum了。
或者直接:
vi /etc/yum.repos.d/CentOS-Base.repo
[base] name=CentOS-5-Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/ gpgcheck=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #released updates [update] name=CentOS-5-Updates #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/ gpgcheck=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #packages used/produced in the build but not released [addons] name=CentOS-5-Addons #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/ gpgcheck=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #additional packages that may be useful