rhel 5 添加 centos 源
先卸载原rhel的yum
别心疼。。。反正你不会去买rhn的
su
进入root下
rpm -aq|grep yum|xargs rpm -e --nodeps
没错是原版的yum全卸载
看自己的系统是x86的还是x64的
uname -a
有 x86_64的用这组地址的rpm
wget http://vault.centos.org/5.11/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://vault.centos.org/5.11/os/x86_64/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
wget http://vault.centos.org/5.11/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
wget http://vault.centos.org/5.11/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
rpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
普通32位的系统
5.11
http://vault.centos.org/5.11/
wget http://vault.centos.org/5.11/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://vault.centos.org/5.11/os/i386/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
wget http://vault.centos.org/5.11/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
wget http://vault.centos.org/5.11/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
rpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-4.el5.i386.rpm
rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
5.5
wget http://vault.centos.org/5.5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
wget http://vault.centos.org/5.5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
wget http://vault.centos.org/5.5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
wget http://vault.centos.org/5.5/os/i386/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
rpm -ivh yum-3.2.22-26.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
5.4
wget http://vault.centos.org/5.4/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
wget http://vault.centos.org/5.4/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
wget http://vault.centos.org/5.4/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
wget http://vault.centos.org/5.4/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
rpm -ivh python-iniparse-0.2.3-4.el5.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
rpm -ivh yum-3.2.22-20.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
下载后安装
最后下自己回车
cd /etc/yum.repos.d/
下载网上别人发的这些centos 5.11的源文件
wget --no-check-certificate https://gist.githubusercontent.com/yogeshlonkar/e2abd1064b0ea8f629048cc06b3333a2/raw/78a56b2063751250fa71a23bdd6691b60e328980/CentOS-Base.repo
wget --no-check-certificate https://gist.githubusercontent.com/yogeshlonkar/e2abd1064b0ea8f629048cc06b3333a2/raw/78a56b2063751250fa71a23bdd6691b60e328980/CentOS-Debuginfo.repo
wget --no-check-certificate https://gist.githubusercontent.com/yogeshlonkar/e2abd1064b0ea8f629048cc06b3333a2/raw/78a56b2063751250fa71a23bdd6691b60e328980/CentOS-fasttrack.repo
wget --no-check-certificate https://gist.githubusercontent.com/yogeshlonkar/e2abd1064b0ea8f629048cc06b3333a2/raw/78a56b2063751250fa71a23bdd6691b60e328980/CentOS-Media.repo
wget --no-check-certificate https://gist.githubusercontent.com/yogeshlonkar/e2abd1064b0ea8f629048cc06b3333a2/raw/78a56b2063751250fa71a23bdd6691b60e328980/CentOS-Sources.repo
wget --no-check-certificate https://gist.githubusercontent.com/yogeshlonkar/e2abd1064b0ea8f629048cc06b3333a2/raw/78a56b2063751250fa71a23bdd6691b60e328980/CentOS-Vault.repo
导入centos的key
rpm -import http://vault.centos.org/RPM-GPG-KEY-CentOS-5
然后yum就可以用了。。。
如果出现
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
/usr/lib/python2.4/site-packages/_sqlitecache.so: wrong ELF class: ELFCLASS32
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.4.3 (#1, Jun 11 2009, 14:09:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq
基本上就x86_64系统用了x86的yum-metadata-parser导致的,卸载重装就好了。。。
推荐阅读: