1、删除RedHat原有的YUM(可以直接备份)
rpm -qa |grep yum #检测源rpm -aq | grep yum|xargs rpm -e --nodeps #卸载原有源2、下载centos下的yum源
wget http://vault.centos.org/5.9/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpmwget http://vault.centos.org/5.9/os/x86_64/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpmwget http://vault.centos.org/5.9/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpmwget http://vault.centos.org/5.9/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm3、安装yum包
rpm -ivh yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm --nodeps --forcerpm -ivh yum-metadata-parser-1.1.2-4.el5.x86_64.rpm --nodeps --forcerpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm --nodeps --forcerpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm --nodeps --force4、修改RedHat.repo文件
[base]name=CentOS-5.9 - Basefailovermethod=prioritybaseurl=http://vault.centos.org/5.9/os/x86_64/gpgcheck=1gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5#released updates[updates]name=CentOS-5.9 - Updatesfailovermethod=prioritybaseurl=http://vault.centos.org/5.9/updates/x86_64/gpgcheck=1gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-5.9 - Extrasfailovermethod=prioritybaseurl=http://vault.centos.org/5.9/extras/x86_64/gpgcheck=1gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus]name=CentOS-5.9 - Plusfailovermethod=prioritybaseurl=http://vault.centos.org/5.9/centosplus/x86_64/gpgcheck=1enabled=0gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-5.9 - Contribfailovermethod=prioritybaseurl=http://vault.centos.org/5.9/contrib/x86_64/gpgcheck=1enabled=0gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-55、清楚缓存
yum clean all6、获取配置YUM列表
yum makecache