第一步:卸載rhel的默認安裝的yum包
查看yum包
rpm -qa|grep yum
卸載之
rpm -qa|grep yum|xargs rpm -e --nodeps
第二步:下載新的yum包
打開網頁 http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/
找到下列rpm包,下載並安裝
yum-3.2.22-26.el5.CentOS.noarch.rpm
yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
並且安裝之
rpm -ivh yum-*
注意:yum和yum-fastestmirror相互依賴,所以同時安裝即可。
第三步:下載yum的配置源
wget http://www.linuxidc.com/files/2011/05/06/CentOS-Base.repo
下載到 /etc/yum.repos.d/ 目錄下面
第四步:運行yum makecache生成緩存
[root@localhost yum.repos.d]# yum makecache
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
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.7.2 (default, Mar 11 2012, 03:08:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://wiki.linux.duke.edu/YumFaq
我在做第四步的時候出現上面的錯誤,原因是我升級了python, 解決方法如下
[root@localhost yum.repos.d]# whereis python
python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python1.5 /usr/lib/python2.4 /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/bin/python /usr/local/lib/python2.7 /usr/include/python2.4 /usr/share/man/man1/python.1.gz
[root@localhost yum.repos.d]# vi /usr/bin/yum
#!/usr/bin/python
import sys
把第一行修改為 #!/usr/bin/python2.4, 然後保存退出。
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
addons | 1.9 kB 00:00
addons/filelists_db | 564 B 00:00
addons/other_db | 552 B 00:00
addons/primary_db | 1.1 kB 00:00
base | 1.1 kB 00:00
base/filelists | 3.0 MB 00:01
這樣就成功了。
RedHat的yum配置 以及 提示“This system is not registered with RHN” 的解決
yum報錯“This system is not registered with RHN”
yum 失敗(This system is not registered with RHN.)解決方法
RedHat提示“This system is not registered with RHN”
紅帽Linux中出現”This system is not registered with RHN”的解決方案
centos在yum install報錯:Another app is currently holding the yum lock解決方法