-bash: yum: command not found 问题解决

操作系统是centos5.6 x86_64,不同的机器已安装的包有所区别,关键是掌握方法。

1下载yum的rpm安装包 

[root@localhost rpm]# wget http://mirror.centos.org/centos/5.7/os/x86_64/CentOS/yum-3.2.22-37.el5.centos.noarch.rpm

2 [root@localhost rpm]# rpm -qa | grep yum   //确定没有安装yum的rpm包
3 [root@localhost rpm]# rpm -ivh yum-3.2.22-37.el5.centos.noarch.rpm
error: Failed dependencies:
        yum-fastestmirror is needed by yum-3.2.22-37.el5.centos.noarch
        yum-metadata-parser >= 1.1.0 is needed by yum-3.2.22-37.el5.centos.noarch

需要安装依赖的包

4 找第一个依赖

 [root@localhost rpm]# wget http://mirror.centos.org/centos/5.7/os/x86_64/CentOS/yum-fastestmirror-1.1.16-16.el5.centos.noarch.rpm

5 安装时发现依赖于yum,这个问题可以两个rpm包一起安装解决,先解决第二个依赖

 [root@localhost rpm]# rpm -ivh yum-fastestmirror-1.1.16-16.el5.centos.noarch.rpm

error: Failed dependencies:
        yum >= 3.0 is needed by yum-fastestmirror-1.1.16-16.el5.centos.noarch

6 先解决第二个依赖

 [root@localhost rpm]# rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm

error: Failed dependencies:
        libxml2.so.2()(64bit) is needed by yum-metadata-parser-1.1.2-3.el5.centos.x86_64

7 发现依赖,下载安装

 [root@localhost rpm]# wget http://mirror.centos.org/centos/5.7/os/x86_64/CentOS/ libxml2-2.6.26-2.1.12.x86_64.rpm

 [root@localhost rpm]# rpm -ivh libxml2-2.6.26-2.1.12.x86_64.rpm
Preparing...                ########################################### [100%]
   1:libxml2                ########################################### [100%]

8 第二个依赖解决,如果还是缺少包,继续下载安装。可以登录http://mirror.centos.org/centos/5.7/os/x86_64/CentOS/ 去找

 [root@localhost rpm]# rpm -ivh yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm

Preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [100%]

9 检验一下yum包的依赖情况

 [root@localhost rpm]# rpm -ivh yum-fastestmirror-1.1.16-16.el5.centos.noarch.rpm 

error: Failed dependencies:
        yum >= 3.0 is needed by yum-fastestmirror-1.1.16-16.el5.centos.noarch
[root@localhost rpm]# rpm -ivh yum-3.2.22-37.el5.centos.noarch.rpm
error: Failed dependencies:
        yum-fastestmirror is needed by yum-3.2.22-37.el5.centos.noarch
10  两个一起安装,解决
[root@localhost rpm]# rpm -ivh yum-3.2.22-37.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-16.el5.centos.noarch.rpm
Preparing...                ########################################### [100%]
   1:yum-fastestmirror      ########################################### [ 50%]

   2:yum                    ########################################### [100%]

11 有需要可以yum -y update


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值