1、删除預設的yum源
# rpm -aq | grep yum|xargs rpm -e --nodeps
2、下載下傳源
# wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm
# wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
3、安裝
# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
4、出現錯誤
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
5、更改python-urlgrabber版本
# rpm -qa|grep python
其中:python-urlgrabber-3.9.1-9.el6.noarch版本小于3.9.1-10
解除安裝python-urlgrabber
# rpm -e python-urlgrabber-3.9.1-9.el6.noarch
下載下傳并安裝對應python-urlgrabber版本
# wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
6、再次成功安裝rpm檔案
7、 更改配置檔案
# cd /etc/yum.repos.d/
# wget http://mirrors.aliyun.com/repo/Centos-6.repo
8、編輯centos-6.repo,将$releasever替換為版本号6
# vi Centos-6.repo
:0,$s/$releasever/6/g
# yum clean all
# yum makecache
# yum - y install vim