使用yum命令出现-bash: /usr/bin/yum: 没有那个文件或目录。以下为解决办法:将redhat源换为centos源。
1.卸载原有YUM
[root@localhost src]#rpm -qa|grep yum|xargs rpm -e--nodeps[root@localhost src]#yum
-bash: /usr/bin/yum: 没有那个文件或目录 从网易下载CentOS的YUM安装包
用wget命令,依次下载 yum, yum-plugin-fastestmirror, yum-metadata-parser, python-iniparse 和 RPM-GPG-KEY-CentOS-6五个文件
注:代码所用字体为Courier New,其中的数字1与字母l易混淆,请注意分辨。特别注意“el6”是“EL6”,而不是“E16”。
[root@tom yum.repos.d]#wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
[root@tom yum.repos.d]#wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
[root@tom yum.repos.d]#wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@tom yum.repos.d]#wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@tom yum.repos.d]#wget http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
(1)安装python-iniparser
[root@tom yum.repos.d]#rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
(2)导入GPG-KEY
[root@tom yum.repos.d]#rpm --import RPM-GPG-KEY-CentOS-6
(3)安装yum-metadata-parser
[root@localhost src]#rpm -ivh yum-metadata-parser.1.1.2-16.el6.x86_64.rpm
(4)同时安装yum 和 yum-plugin-fastestmirror (因为它们俩相互依赖)
[root@localhost src]#rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
[root@localhost src]#cd /etc/yum.repos.d
[root@localhost yum.repos.d]#
下载网易的YUM源配置
[root@localhost yum.repos.d]#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@localhost yum.repos.d]#
利用vim查看CentOS6-Base-163.repo文件。在vim的命令模式下输入:%s/$releasever/6/g把整个文件下的$releasever替换为6。替换次数为15 次,共 15行的字样。保存退出。
[root@localhost yum.repos.d]#vim CentOS6-Base-163.repo:% s/$releasever/6/g
:wq
[root@localhost yum.repos.d]#
清除YUM的缓存
[root@localhost yum.repos.d]#yum clean all