1、下载安装包

#wget http://tel.mirrors.163.com/CentOS/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm

#wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm

#wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.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

注:需要注意的是这个下载的路径在近期是可以的,时间长的话有可能会改变地址

2、卸载原有的rpm包

#rpm -qa|grep yum

#rpm -e --nodeps yum-*(查出来的包的名称)

3、安装新的包

#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

二、配置文件

1、下载CentOS6-Base-163.repo

#cd /etc/yum.repos.d

#mv CentOS6-Base-163.repo CentOS6-Base-163.repo.bak

#wget http://mirrors.163.com/.help/centos.html?1304848825/CentOS6-Base-163.repo

2、配置

#vi CentOS6-Base-163.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/os/$basearch/

gpgcheck=0

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/updates/$basearch/

gpgcheck=0

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/addons/$basearch/

gpgcheck=0

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/extras/$basearch/

gpgcheck=0

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/centosplus/$basearch/

gpgcheck=0

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/contrib/$basearch/

gpgcheck=0

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# vi dag.repo

[dag]

name=Dag RPM Repository for RHEL5

baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/

enabled=1

gpgcheck=0

gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt

[root@localhost yum.repos.d]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: addons base dag extras update
Cleaning up Everything
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
addons                                                                                                        | 1.9 kB     00:00     
addons/filelists_db                                                                                           |  570 B     00:00     
addons/primary_db                                                                                             | 1.1 kB     00:00     
addons/other_db                                                                                               |  554 B     00:00     
base                                                                                                          | 1.1 kB     00:00     
base/group                                                                                                    | 1.1 MB     00:07     
base/filelists                                                                                                | 3.7 MB     00:32     
base/primary                                                                                                  | 1.3 MB     00:11     
base/other                                                                                                    |  14 MB     01:51     
base                                                                                                                       3667/3667
base                                                                                                                       3667/3667
base                                                                                                                       3667/3667
dag                                                                                                           | 1.9 kB     00:00     
dag/filelists_db                                                                                              | 6.1 MB     09:28     
dag/primary_db                                                                                                | 7.0 MB     08:19     
dag/other_db                                                                                                  | 1.5 MB     01:56     
extras                                                                                                        | 2.1 kB     00:00     
extras/group                                                                                                  | 9.7 kB     00:00     
extras/filelists_db                                                                                           | 224 kB     00:06     
extras/primary_db                                                                                             | 173 kB     00:05     
extras/other_db                                                                                               | 442 kB     00:15     
update                                                                                                        | 1.9 kB     00:00     
update/filelists_db                                                                                           | 3.1 MB     01:07     
update/primary_db                                                                                             | 700 kB     00:13     
update/other_db                                                                                               |  17 MB     05:01     
Metadata Cache Created
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]#


导入key
[root@linux-a ~]# rpm --import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
运行YUM,测试
 yum install httpd