yum失败

问题:

在CentOS 5.5中需要使用yum安装程序,出现错误:

There was a problem importing one of the Python modules

required to run yum. The error leading to this problem was:

/usr/lib/python2.4/site-packages/_sqlitecache.so: wrong ELF class: ELFCLASS32

Please install a package which provides this module, or
verify that the module is installed correctly.

解决办法:

放狗搜,原因是python版本不兼容,办法是卸载原来的yum重新安装;


1. 确定当前CentOS的版本

[root@centos-74 yum.repos.d]# lsb_release -a
LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: CentOS
Description:    CentOS release 5.5 (Final)
Release:        5.5
Codename:       Final

可以看到当前的CentOS版本是5.5;

[root@centos-74 yum.repos.d]# uname -a
Linux centos-74 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

可以看到所安装的是X86_64的系统;

2. 安装yum程序

2.1 从网易的mirrors下载所需要的rpm包;

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm

该文件从网易的站点已经下载不到了,只有python-iniparse-0.2.3-6.el5.noarch.rpm但是python-iniparse-0.2.3-6.el5.noarch.rpm会与其他三个文件存在兼容性问题,所以,放狗搜一下,从其他地方下载python-iniparse-0.2.3-4.el5.noarch.rpm

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.centos.x86_64.rpm

2.2 安装已经下载的软件包

rpm -ivh --nodeps python-iniparse-0.2.3-4.el5.noarch.rpm yum-3.2.22-40.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.centos.x86_64.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

不知为什么,上述命令执行完毕后只提示安装了第一个软件包python-iniparse-0.2.3-4.el5.noarch.rpm

Preparing...                ########################################### [100%]
        package python-iniparse-0.2.3-4.el5.noarch is already installed

再次安装剩余的软件包,

rpm -ivh --nodeps yum-3.2.22-40.el5.centos.noarch.rpm yum-metadata-parser-1.1.2-4.el5.centos.x86_64.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

Preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [ 33%]
   2:yum-fastestmirror      ########################################### [ 67%]
   3:yum                    ########################################### [100%]

通过命令rpm -qa | grep yum查看安装结果

[root@centos-74 zhao]# rpm -qa|grep yum
yum-3.2.22-40.el5.centos
yum-fastestmirror-1.1.16-21.el5.centos
yum-metadata-parser-1.1.2-4.el5
[root@centos-74 zhao]#

导入证书

rpm -import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5

让yum使用网易的源:

#cd /etc/yum.repos.d/
#wget http://mirrors.163.com/.help/CentOS-Base-163.repo

编辑CentOS-Base-163.repo,在所有mirrorlist前面加上#,把所有$releasever替换成5,然后保存。

#yum clean metadata

完成后yum可以正常工作,更新yum

#yum -y upgrade

 

你可能感兴趣的:(yum)