红联Linux门户
Linux帮助

”This system is not registered with RHN”的解决方案

发布时间:2014-11-20 14:56:18来源:linux网站作者:langeldep

yum install 在红帽中提示”This system is not registered with RHN”的解决方案。


第一步:卸载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   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

 
这样就成功了。