yum安装与问题处理

一、linux系统安装yum环境

1、卸载rhel的默认安装的yum包
查看yum包
rpm -qa|grep yum
卸载之
rpm -qa|grep yum|xargs rpm -e --nodeps


2、下载新的yum包
64位linux系统下载安装包
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
32位linux系统下载安装包
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm


注意:安装包可能会升级,最后的文件名可以通过最新路径下查看得到,例如:
http://centos.ustc.edu.cn/centos/5/os/x86_64/CentOS/
http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/


然后进行安装
rpm -ivh yum-*
注意:yum和yum-fastestmirror相互依赖,所以同时安装即可。
3、下载yum的配置源
wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo 下载到 /etc/yum.repos.d/ 目录下面


4、运行yum makecache生成缓存

二、安装了Python2.7,发现yum无法使用

报错信息如下:
$ 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.7.3 (default, Jul 17 2014, 11:10:02) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)]


If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

原因:
应该是系统是使用的默认的python2.4的版本

解决办法:
修改yum文件
#vim /usr/bin/yum

#!/usr/bin/python 
修改为 
#!/usr/bin/python2.4

三、yum 运行错误

错误提示:
$ yum list
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile




解决办法:
Centons下
其大概意思是fastestmirror不能使用,fastestmirror是yum的一个加速插件,具体我也没有仔细了解过,
可能是系统不支持或者缺少组建导致的。
处理办法就是禁用这个插件,方法如下:
$vim  /etc/yum/pluginconf.d/fastestmirror.conf   
  
[main]   
enabled=0  //把1改为0  
verbose=0  
socket_timeout=3  
hostfilepath=/var/cache/yum/timedhosts.txt   
maxhostfileage=10  
maxthreads=15  
#exclude=.gov, facebook
=======================================================================================
修改以下配置文件
 #vi /etc/yum.conf


[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1                 #将plugins的值修改为0
installonly_limit=5


四、yum运行错误

错误提示:
$ yum list
Segmentation Fault


解决办法:
# rpm -q zlib zlib-devel
# cp /usr/lib/libz.so.1.2.3 /usr/local/lib/
# cd /usr/local/lib                        
# ln -sf libz.so.1.2.3 libz.so             
# ln -sf libz.so.1.2.3 libz.so.1
# yum clean all

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

北雨南萍

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

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

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

打赏作者

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

抵扣说明:

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

余额充值