删除redhat原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps
删除RHEL的发行版
rpm -e --nodeps redhat-release-server-6Server-6.0.0.37.el6.i686 redhat-indexhtml-6-1.el6.noarch
可以简写
rpm -e --nodeps redhat-release-server redhat-indexhtml
不删除会报错
mirrors.163.com/centos/%24releasever/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404 : http://mirrors.163.com/centos/%24releasever/os/i386/repodata/repomd.xml
下载下列安装包
wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/centos-release-6-4.el6.centos.10.x86_64.rpm
wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/centos-indexhtml-6-1.el6.centos.noarch.rpm
wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
安装
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-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm 两个包必需同时安装,否则会相互依赖
rpm -ivh centos-release-6-4.el6.centos.10.x86_64.rpm
rpm -ivh centos-indexhtml-6-1.el6.centos.noarch.rpm
进入/etc/yum.repos.d/
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum clean all
yum makecache