手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

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

[日期:2012-03-14] 来源:Linux社区  作者:langeldep [字体:大 中 小]

第一步:卸载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    
这样就成功了。

linux
相关资讯       redhat 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款