因爲 redhat 的 yum 在線更新是收費的,若是沒有註冊的話不能使用,若是要使用,需將 redhat 的 yum 卸載後,重啓安裝,再配置其餘源.node
一、刪除 redhat 原有 yumpython
# rpm -aq | grep yum | xargs rpm -e --nodepsvim
二、下載 yum 安裝文件(若是下載時找不到文件,就登陸到:http://mirrors.163.com/centos/6/os/x86_64/ 上查找相應的文件,而後再下載)centos
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm bash
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm 測試
三、安裝yumui
# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpmurl
# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm (注意最後兩個包必需同時安裝,不然會相互依賴).net
安裝會提示:debug
warning: yum-3.2.29-81.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-81.el6.centos.noarch
須要安裝python-urlgrabber依賴(由於系統已經安裝了舊版本,先刪除,再安裝)
# rpm -qa | grep python-urlgrabber
python-urlgrabber-3.9.1-8.el6.noarch
# rpm -e python-urlgrabber-3.9.1-8.el6.noarch
# 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%]
1:python-urlgrabber ########################################### [100%]
[root@localhost Downloads]# rpm -qa | grep python-urlgrabber
再執行下面安裝
# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum-plugin-fastestmirro########################################### [ 50%]
2:yum ########################################### [100%]
安裝成功。
三、更新 repo 文件(目錄 /etc/yum.repos.d/ 下原來的文件都是能夠刪除的)
# mv /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bak
# touch /etc/yum.repos.d/rhel-debuginfo.repo
# vi /etc/yum.repos.d/rhel-debuginfo.repo
[base] name=CentOS-$releasever - Base baseurl=http://mirrors.163.com/centos/6/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #packages used/produced in the build but not released #[addons] #name=CentOS-$releasever - Addons #baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/ #gpgcheck=1 #gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ gpgcheck=1 enabled=0
測試一下:
# yum clean all
# update/install vim 測試下
# yum -y install vim
四、yum 的相關配置能夠在文件 /etc/yum.conf 中來指定(通常不用修改)
yum下載安裝過的安裝包能夠在目錄 /var/cache/yum/x86_64/$releasever/base/packages 下找到。