#删除原有的yum包
rpm -qa | grep yum|xargs rpm -e –nodeps
#安装yum包
rpm -ivh http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-60.el6.centos.noarch.rpm http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
注:最后一条的包两个包需要一起安装。
#添加源
cd /etc/yum.repos.d/
mkdir -p /home/backup/yum.repos.d/
mv * /home/backup/yum.repos.d/
#备份配置文件
wget -O /etc/yum.repos.d/rhel-source.repo http://mirrors.aliyun.com/repo/Centos-6.repo
sed -i 's/\$releasever/6/g' rhel-source.repo
#清理yum缓存
yum clean all
#将服务器上的软件包信息缓存到本地,以提高速度
yum makecache
#测试安装
yum install bash