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
9、清理yum缓存
# yum clean all
# yum makecache
10、测试安装效果
# yum - y install vim