操作系统是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.rpmPreparing... ########################################### [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