#/bin/bash

tmpdir=`mktemp -d`

cd $tmpdir

rpm -qa |grep yum |xargs rpm -e --nodeps

wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm

rpm --import http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

rpm -ivh python-*

rpm -ivh yum-*

cd ..

rm -fr $tmpdir

cd /etc/yum.repos.d/

tar cfvz repo.tar.gz * --remove-files      

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

sed -i "s/\$releasever/6/g" /etc/yum.repos.d/CentOS-Base.repo

yum clean all

yum makecache

exit