1.删除**redhat原有的yum** 

<a style="background-color: inherit;"><font color="#333333">rpm -aq|grep yum|xargs rpm -e --nodeps&nbsp;</font></a>

2.</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">下载</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">安装文件</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">&nbsp;</span>

<span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">可以到</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">centos6.4</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">光盘镜像里复制出来</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum-3.2.29-40.el6.centos.noarch.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum-metadata-parser-1.1.2-16.el6.x86_64.rpm</span>

<span lang="EN-US" style="color: red; font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">python-iniparse-0.3.1-2.1.el6.noarch.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum-utils-1.1.30-14.el6.noarch.rpm</span>

<span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">下面</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">2</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">个用</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">redhat</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">光盘里的</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum-rhn-plugin-0.9.1-43.el6.noarch.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">PackageKit-yum-plugin-0.5.8-21.el6.x86_64.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">PackageKit-yum-0.5.8-21.el6.x86_64.rpm

3.</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">进行安装</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">yum&nbsp;

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</span>

<span style="color: red; font-size: 10.5pt; background-color: inherit;">注意最后两个包必需同时安装,否则会相互依赖</span><span lang="EN-US" style="color: red; font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">&nbsp;</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">rpm -ivh PackageKit-yum-0.5.8-21.el6.x86_64.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">rpm -ivh PackageKit-yum-plugin-0.5.8-21.el6.x86_64.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">rpm -ivh yum-utils-1.1.30-14.el6.noarch.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">rpm -ivh yum-rhn-plugin-0.9.1-43.el6.noarch.rpm</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">4.</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">更新</span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">repo</span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">文件</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">/etc/yum.re pos.d/rhel-debuginfo.repo&nbsp; </span><span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">先备份一遍</span>

<span style="color: rgb(51, 51, 51); font-size: 10.5pt; background-color: inherit;">从其他系统复制</span>**<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">CentOS6-Base-163.repo </span>****<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">拷贝过来</span>**

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">vi&nbsp;/etc/yum.repos.d/</span>**<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">CentOS6-Base-163.repo</span>**

**<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">编辑</span>****<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">CentOS6-Base-163.repo</span>****<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">文件,将其中的</span>****<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">$releasever</span>****<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">更改为</span>****<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">centos</span>****<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">的版本号</span>**

<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">下面是修改好的:</span>

<span style="font-family: 宋体; background-color: inherit;"># CentOS-Base.repo</span>

<span style="font-family: 宋体; background-color: inherit;">#</span>

<span style="font-family: 宋体; background-color: inherit;"># The mirror system uses the connecting IP address of the client and the</span>

<span style="font-family: 宋体; background-color: inherit;"># update status of each mirror to pick mirrors that are updated to and</span>

<span style="font-family: 宋体; background-color: inherit;"># geographically close to the client.<span style="background-color: inherit;">&nbsp; </span>You should use this for CentOS updates</span>

<span style="font-family: 宋体; background-color: inherit;"># unless you are manually picking other mirrors.</span>

<span style="font-family: 宋体; background-color: inherit;">#</span>

<span style="font-family: 宋体; background-color: inherit;"># If the mirrorlist= does not work for you, as a fall back you can try the</span>

<span style="font-family: 宋体; background-color: inherit;"># remarked out baseurl= line instead.</span>

&nbsp;

<span style="font-family: 宋体; background-color: inherit;">[base]</span>

<span style="font-family: 宋体; background-color: inherit;">name=CentOS-6.4 - Base</span>

<span style="font-family: 宋体; background-color: inherit;">mirrorlist=http://mirrorlist.centos.org/?release=6.4&amp;arch=$basearch&amp;repo=os</span>

<span style="font-family: 宋体; background-color: inherit;">#baseurl=http://mirror.centos.org/centos/6.4/os/$basearch/</span>

<span style="font-family: 宋体; background-color: inherit;">gpgcheck=1</span>

<span style="font-family: 宋体; background-color: inherit;">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6</span>

<span style="font-family: 宋体; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span>

<span style="font-family: 宋体; background-color: inherit;">#released updates</span>

<span style="font-family: 宋体; background-color: inherit;">[updates]</span>

<span style="font-family: 宋体; background-color: inherit;">name=CentOS-6.4 - Updates</span>

<span style="font-family: 宋体; background-color: inherit;">mirrorlist=http://mirrorlist.centos.org/?release=6.4&amp;arch=$basearch&amp;repo=updates</span>

<span style="font-family: 宋体; background-color: inherit;">#baseurl=http://mirror.centos.org/centos/6.4/updates/$basearch/</span>

<span style="font-family: 宋体; background-color: inherit;">gpgcheck=1</span>

<span style="font-family: 宋体; background-color: inherit;">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6</span>

<span style="font-family: 宋体; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span>

<span style="font-family: 宋体; background-color: inherit;">#additional packages that may be useful</span>

<span style="font-family: 宋体; background-color: inherit;">[extras]</span>

<span style="font-family: 宋体; background-color: inherit;">name=CentOS-6.4 - Extras</span>

<span style="font-family: 宋体; background-color: inherit;">mirrorlist=http://mirrorlist.centos.org/?release=6.4&amp;arch=$basearch&amp;repo=extras</span>

<span style="font-family: 宋体; background-color: inherit;">#baseurl=http://mirror.centos.org/centos/6.4/extras/$basearch/</span>

<span style="font-family: 宋体; background-color: inherit;">gpgcheck=1</span>

<span style="font-family: 宋体; background-color: inherit;">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6</span>

<span style="font-family: 宋体; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span>

<span style="font-family: 宋体; background-color: inherit;">#additional packages that extend functionality of existing packages</span>

<span style="font-family: 宋体; background-color: inherit;">[centosplus]</span>

<span style="font-family: 宋体; background-color: inherit;">name=CentOS-6.4 - Plus</span>

<span style="font-family: 宋体; background-color: inherit;">mirrorlist=http://mirrorlist.centos.org/?release=6.4&amp;arch=$basearch&amp;repo=centosplus</span>

<span style="font-family: 宋体; background-color: inherit;">#baseurl=http://mirror.centos.org/centos/6.4/centosplus/$basearch/</span>

<span style="font-family: 宋体; background-color: inherit;">gpgcheck=1</span>

<span style="font-family: 宋体; background-color: inherit;">enabled=0</span>

<span style="font-family: 宋体; background-color: inherit;">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6</span>

<span style="font-family: 宋体; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span>

<span style="font-family: 宋体; background-color: inherit;">#contrib - packages by Centos Users</span>

<span style="font-family: 宋体; background-color: inherit;">[contrib]</span>

<span style="font-family: 宋体; background-color: inherit;">name=CentOS-6.4 - Contrib</span>

<span style="font-family: 宋体; background-color: inherit;">mirrorlist=http://mirrorlist.centos.org/?release=6.4&amp;arch=$basearch&amp;repo=contrib</span>

<span style="font-family: 宋体; background-color: inherit;">#baseurl=http://mirror.centos.org/centos/6.4/contrib/$basearch/</span>

<span style="font-family: 宋体; background-color: inherit;">gpgcheck=1</span>

<span style="font-family: 宋体; background-color: inherit;">enabled=0</span>

<span style="font-family: 宋体; background-color: inherit;">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6</span>

<span style="font-family: 宋体; background-color: inherit;"><span style="background-color: inherit;">&nbsp;######</span></span>

<span style="font-family: 宋体; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span><span style="font-family: 宋体; background-color: yellow;">/etc/pki/rpm-gpg/下的文件从centos里拷贝过来</span>

<span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 10.5pt; background-color: inherit;"><span style="background-color: inherit;">&nbsp;</span></span><span lang="EN-US" style="color: rgb(51, 51, 51); font-family: Helvetica, sans-serif; font-size: 10.5pt; background-color: inherit;">6<span style="background-color: inherit;">&nbsp; </span></span>**<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">yum clean all</span>**<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">&nbsp;</span>**<span style="color: rgb(50, 62, 50); font-family: 微软雅黑, sans-serif; font-size: 10.5pt; background-color: inherit;">清除原有缓存</span>**

**<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">7</span>****<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">、</span>****<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">yum makecache&nbsp;</span>**<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">&nbsp;</span>**<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">获取</span>****<span lang="EN-US" style="color: rgb(50, 62, 50); font-family: simsun, serif; font-size: 10.5pt; background-color: inherit;">yum</span>****<span style="color: rgb(50, 62, 50); font-size: 10.5pt; background-color: inherit;">列表</span>**