1、备份或删除yum源配置文件
#cd /etc/yum.repos.d
#mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
2、编辑vi /etc/yum.repos.d/CentOS-Base.repo,填入以下内容
######################
[base]
name=CentOS-5 - Base
repo=os
baseurl= http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey= http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[update]
name=CentOS-5 - Updates
baseurl= http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey= http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[addons]
name=CentOS-5 - Addons
baseurl= http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey= http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-5 - Extras
baseurl= http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey= http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-5 - Plus
baseurl= http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey= http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-5 - Contrib
baseurl= http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey= http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
###################
3、上传yum源包yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
执行命令
rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
由此yum就安装好了。