配置yum 等出错一系统解决方法

实验环境:CentOS linux 5.4 32位
系统已安装的组件包:开发工具,其他都没装
[root@wellpie ~]# rpm -qa yum
yum-3.2.22-20.el5.centos
用命令查了一下原来我在装开发工具时原来已经有装了yum了。
不过我还是删了,来重新安装一下做一下笔记。

首先我要下载我配置yum的一个软件包,我先试一下有没有wget这个软件,原来我我只装开发工具的时候,里面服务器配置工具什么都没有。所以wget也只能通过yum先装一下再来配置。如果你没有yum,也没有wget,那只能通过ftp或其他途径上传一个wget或yum的安装包。

下面是我们以下载好的yum包,如下:
[root@RedHat soft]# ls
DenyHosts-2.6.tar.gz  libmcrypt-2.5.8.tar.bz2  vnstat_php.tar.gz
down.txt              mysql-5.0.91.tar.gz      vsftpd-2.0.6.tar.gz
gd-2.0.32.tar.gz      php-5.2.14.tar.gz        yum_forAS4.tar.gz
httpd-2.2.4.tar.gz    vnstat-1.10.tar.gz       ZendOptimizer-3.2.2-linux.tar.gz
#解压yum安装包。
[root@RedHat soft]# tar zxvf yum_forAS4.tar.gz
yum_forAS4/
yum_forAS4/CentOS-Base.repo
yum_forAS4/python-elementtree-1.2.6-7.el4.rf.i386.rpm
yum_forAS4/python-urlgrabber-2.9.7-1.2.el4.rf.noarch.rpm
yum_forAS4/yum-2.4.2-0.4.el4.rf.noarch.rpm
yum_forAS4/sqlite-2.8.16-1.2.el4.rf.i386.rpm
yum_forAS4/python-sqlite-1.0.1-1.2.el4.rf.i386.rpm
[root@RedHat soft]# cd yum_forAS4
[root@RedHat yum_forAS4]# ls
CentOS-Base.repo
python-elementtree-1.2.6-7.el4.rf.i386.rpm
python-sqlite-1.0.1-1.2.el4.rf.i386.rpm
python-urlgrabber-2.9.7-1.2.el4.rf.noarch.rpm
sqlite-2.8.16-1.2.el4.rf.i386.rpm
yum-2.4.2-0.4.el4.rf.noarch.rpm
[root@RedHat yum_forAS4]# rpm -ivh *.rpm
warning: python-elementtree-1.2.6-7.el4.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
        libreadline.so.4 is needed by sqlite-2.8.16-1.2.el4.rf.i386
        yum < 3.2.0 conflicts with yum-metadata-parser-1.1.2-3.el5.centos.i386
#看来原来安装的yum包还没卸载。
[root@RedHat yum_forAS4]# rpm -qa |grep yum
yum-metadata-parser-1.1.2-3.el5.centos
yum-fastestmirror-1.1.16-13.el5.centos
yum-3.2.22-20.el5.centos
[root@RedHat yum_forAS4]# rpm -e yum-3.2.22
error: Failed dependencies:
        yum >= 3.0 is needed by (installed) yum-fastestmirror-1.1.16-13.el5.centos.noarch
[root@RedHat yum_forAS4]# rpm -e yum-\*
error: Failed dependencies:
        yum >= 3.0 is needed by (installed) yum-fastestmirror-1.1.16-13.el5.centos.noarch
#看来这样卸载还不行。只能一个一个卸载了。
[root@RedHat yum_forAS4]# rpm -e yum-3.2.22 --nodeps
[root@RedHat yum_forAS4]# rpm -qa|grep yum
yum-metadata-parser-1.1.2-3.el5.centos
yum-fastestmirror-1.1.16-13.el5.centos
#看来用--nodeps参数,就可以卸载了,只剩下2个了。现在再安装一下我们下载的yum包看如何。
[root@RedHat yum_forAS4]# rpm -ivh *.rpm
warning: python-elementtree-1.2.6-7.el4.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
        libreadline.so.4 is needed by sqlite-2.8.16-1.2.el4.rf.i386
        yum < 3.2.0 conflicts with yum-metadata-parser-1.1.2-3.el5.centos.i386
#晕,还不行。可能那2个没卸载还真不行。
[root@RedHat yum_forAS4]# rpm -e yum-metadata-parser-1.1.2
[root@RedHat yum_forAS4]# rpm -e yum-fastestmirror-1.1.16
[root@RedHat yum_forAS4]# rpm -qa|grep yum
[root@RedHat yum_forAS4]#
#现在查不到有yum包了
[root@RedHat yum_forAS4]# rpm -ivh *.rpm
warning: python-elementtree-1.2.6-7.el4.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
        libreadline.so.4 is needed by sqlite-2.8.16-1.2.el4.rf.i386
[root@RedHat yum_forAS4]#
#看来之前有安装过的yum包还真不行。问题多,其实是因为我目前环境是CentOS 5.4而那yum包适合AS4的,所以不适合。
--------------------------------------------------------------------------错误解决过程开始
#到网上查一下资料,安装一个readline-4.3.5.2.i386.rpm
[root@RedHat ~]# rpm -ivh readline-4.3-5.2.i386.rpm
warning: readline-4.3-5.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 025e513b
Preparing...                ########################################### [100%]
        package readline-5.1-3.el5.i386 (which is newer than readline-4.3-5.2.i386) is already installed
        file /usr/share/info/history.info.gz from install of readline-4.3-5.2.i386 conflicts with file from package readline-5.1-3.el5.i386
        file /usr/share/info/readline.info.gz from install of readline-4.3-5.2.i386 conflicts with file from package readline-5.1-3.el5.i386
        file /usr/share/info/rluserman.info.gz from install of readline-4.3-5.2.i386 conflicts with file from package readline-5.1-3.el5.i386
        file /usr/share/man/man3/history.3.gz from install of readline-4.3-5.2.i386 conflicts with file from package readline-5.1-3.el5.i386
        file /usr/share/man/man3/readline.3.gz from install of readline-4.3-5.2.i386 conflicts with file from package readline-5.1-3.el5.i386
[root@RedHat ~]#
#安装后不知道是否还会出现错误。
[root@RedHat yum_forAS4]# rpm -ivh *.rpm
warning: python-elementtree-1.2.6-7.el4.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
error: Failed dependencies:
        libreadline.so.4 is needed by sqlite-2.8.16-1.2.el4.rf.i386
[root@RedHat yum_forAS4]#
唉,还不行。

最后在姚兄的帮忙下,才知道原来我的系统版本是CentOS 5.5,而我的yum安装包是yum_forAS4的,所以不适合。
[root@RedHat yum_forAS4]# rpm -Uvh http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
Retrieving http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
error: Failed dependencies:
        yum-fastestmirror is needed by yum-3.2.22-26.el5.centos.noarch
        yum-metadata-parser >= 1.1.0 is needed by yum-3.2.22-26.el5.centos.noarch
又是依赖关系。
-------------------------------------------------------------------------错误解决过程结束

[root@RedHat yum_forAS4]# rpm -Uvh http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm  http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
Retrieving http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
Retrieving http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
Retrieving http://mirrors.163.com/centos/5.5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
Preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [ 33%]
   2:yum-fastestmirror      ########################################### [ 67%]
   3:yum                    ########################################### [100%]
[root@RedHat soft]# rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
现在yum就可以使用了。


用Uvh与ivh的区别:
(1)如果安装有这个软件包,U会先安装新的软件包,然后cleanup旧的,rpm database里边会记录新的软件包,而i的时候,只会安装新的软件包,并且在rpm database里边对于该软件包有两个版本
(2) 如果没有安装这个软件包,U和i功能一样,没有区别
但是对于内核的安装这块,推荐使用i,这样同时会保留旧的内核,一旦新的内核有问题可以迅速切换到旧的内核,给自己留个后路
 

你可能感兴趣的:(职场,休闲,配置yum)