1.将RHEL自带的yum相关包卸载:rpm -aq|grep yum|xargs rpm -e –nodeps 2.去合适的源里下载以下四个包: yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm (或者是i386版的) yum-3.2.22-20.el5.centos.noarch.rpm python-iniparse-0.2.3-4.el5.noarch.rpm 我是在http://ftp.sjtu.edu.cn/centos/5.4/os/x86_64/ ,下载的。
3.将以上下载的四个包放在同一个目录下,然后进行安装,请注意,最好四个包同时安装,避免出现依赖问题,例如 rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm yum-3.2.22-20.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
4.修改/etc/yum.repos.d/CenOS-Base.repo为以下内容: [base] name=CentOS-5- Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch& repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ baseurl=http://ftp.sjtu.edu.cn/centos/5.4/os/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #released updates [update] name=CentOS-5- Updates #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates baseurl=http://ftp.sjtu.edu.cn/centos/5.4/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #packages used/produced in the build but not released [addons] name=CentOS-5- Addons #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons baseurl=http://ftp.sjtu.edu.cn/centos/5.4/addons/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #additional packages that may be useful [extras] name=CentOS-5- Extras #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras baseurl=http://ftp.sjtu.edu.cn/centos/5.4/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-5- Plus #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus baseurl=http://ftp.sjtu.edu.cn/centos/5.4/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #contrib - packages by Centos Users [contrib] name=CentOS-5- Contrib #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib baseurl=http://ftp.sjtu.edu.cn/centos/5.4/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 [base] name=CentOS-5- Base #mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch& repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ baseurl=http://ftp.sjtu.edu.cn/centos/5.4/os/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #released updates [update] name=CentOS-5- Updates #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates baseurl=http://ftp.sjtu.edu.cn/centos/5.4/updates/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #packages used/produced in the build but not released [addons] name=CentOS-5- Addons #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons baseurl=http://ftp.sjtu.edu.cn/centos/5.4/addons/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #additional packages that may be useful [extras] name=CentOS-5- Extras #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras baseurl=http://ftp.sjtu.edu.cn/centos/5.4/extras/$basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-5- Plus #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus baseurl=http://ftp.sjtu.edu.cn/centos/5.4/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5 #contrib - packages by Centos Users [contrib] name=CentOS-5- Contrib #mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib baseurl=http://ftp.sjtu.edu.cn/centos/5.4/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
5. rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 6.yum update |