centos下安装yum

在搭建storm中需要安装python2.6.centos中默认安装的是python2.4.关于python的升级见文章:[url]http://wind35.iteye.com/admin/categories/292186[/url]
升级后在运行yum出现问题

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.6.1 (r261:67515, Aug 7 2010, 11:36:17)
[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
提示当前版本是2.6.1可能版本不匹配。没有yum依赖的包。

头脑一热既然yum不兼容,则想着卸载yum重新安装。卸载yum是大忌在linux中。卸载后安装比较麻烦。yum完全安装需要:
yum-3.2.22-33.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
在三个包在没有yum的情况下比较难找,好在在centos的安装文件中有安装如下:

mkdir /test/media #创建挂在目录
mnt /dev/dvd /test/media #挂在dvd
cd /test/media/centos
rpm -ivh yum-3.2.22-33.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

由于升级了python,此时运行yum还是会报错,只需要修改yum配置文件让yum用旧版本的python运行即可:

vi /usr/bin/yum将
#!/usr/bin/python
改为:
#!/usr/bin/python2.4


使用python 升级yum:

安装EPEL的rpm包
rpm -ivh http://download.slogra.com/epel-release-5-4.noarch.rpm
yum升级python
yum -y install python26
备份老的python版本,并使用新python版本
mv /usr/bin/python /usr/bin/python.old
ln -s /usr/bin/python26 /usr/bin/python
vi /usr/bin/yum
将第一行的python后加上2.4,即第一行改为:
#!/usr/bin/python2.4

参考文章:
[url]http://blog.slogra.com/post-235.html[/url]
[url]http://blog.sina.com.cn/s/blog_62c8f3c901012s5c.html[/url]
[url]http://blog.csdn.net/oyzl68/article/details/22932227[/url]
[url]http://blog.chinaunix.net/uid-29020-id-3886291.html[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值