-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.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
redhat 6.4
Red Hat Enterprise 6.4配置CentOS 6.4软件源
1. 用su 命令切换到root
2. 删除rhel6.4自带的yum,命令如下: rpm -aq|grep yum|xargs rpm -e --nodeps 3.
下载CentOS 6.4的yum,命令如下:
wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm wget http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
4.安装yum
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm rpm -ivh
yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
5.配置repo文件
新建CentOS-Base.repo文件,内容为: [base]
name=CentOS-6 - Base repo=os
baseurl=http://mirrors.163.com/centos/6.4/os/$basearch/ gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates [update]
name=CentOS-6 - Updates
baseurl=http://mirrors.163.com/centos/6.4/updates/$basearch/ gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released #[addons]
#name=CentOS-6 - Addons
#baseurl=http://mirrors.163.com/centos/6.4/addons/$basearch/ #gpgcheck=1
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful [extras]
name=CentOS-6 - Extras
baseurl=http://mirrors.163.com/centos/6.4/extras/$basearch/ gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages [centosplus]
name=CentOS-6 - Plus
baseurl=http://mirrors.163.com/centos/6.4/centosplus/$basearch/ gpgcheck=1 enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users [contrib]
name=CentOS-6 - Contrib
baseurl=http://mirrors.163.com/centos/6.4/contrib/$basearch/ gpgcheck=1 enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
保存后将CentOS-Base.repo移到/etc/yum.repos.d/ 里面,命令如下: mv ./CentOS-Base.repo /etc/yum.repos.d/ 6.清除yum缓存
clean yum all
7.试试能不能用 yum install gcc-c++-4.4.7-3.el6
(责任编辑:IT) |