Replace yum repository on redhat6

1.delete yum repo on redhat6

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

2.download centos’s rpm packages

wget http://mirror.centos.org/centos/6.0/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

3.install rmp packages, the last two must be installed at the same time

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

4.modify yum repo, add mirror of netease

cd /etc/yum.repos.d/ && wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

5.replace all $releasever to 6 in CentOS6-Base-163.repo

6.clean/cache

yum clean all && yum makecache

P.S. if got key error when installed, please import RMP KEY

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