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   http://docs.linuxtone.org/soft/lemp/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     
这样就成功了。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

langeldep

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值