Loading
0

解决:-bash: yum: 未找到命令/-bash: yum: command not found

1000x200


前言:在通过yum命令安装软件时报错“-bash: yum: 未找到命令”或者 “-bash: /usr/bin/yum: 没有那个文件或目录”或者“-bash: yum: command not found”报错看没有安装yum命令,通常情况下linux系统会默认安装该命令,应该是yum命令被卸载删除导致。
原因:yum命令被卸载删除
Centos 7.X版本为例
解决:
1、执行如下命令查看是否有安装yum,若返回为空,则表示没安装

rpm -qa |grep yum

2、若没安装,分别执行如下命令安装即可

wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-cron-3.4.3-168.el7.centos.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
rpm -ivh --force --nodeps python-urlgrabber-3.10-10.el7.noarch.rpm
rpm -ivh --force --nodeps yum-cron-3.4.3-168.el7.centos.noarch.rpm
rpm -ivh --force --nodeps yum-3.4.3-168.el7.centos.noarch.rpm
rpm -ivh --force --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh --force --nodeps yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

安装后执行yum命令,若能显示信息,则说明安装成功。
注意:若安装过程中出现“no module named yum”报错提示,请执行如下命令即可

wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-2.7.5-89.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-devel-2.7.5-89.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-libs-2.7.5-89.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-45.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-aliases-1.1.31-54.el7_8.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-54.el7_8.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpm
wget  http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
rpm -ivh --force *.rpm --nodeps

题外话:若要卸载yum命令为:“ rpm -aq|grep yum|xargs rpm -e --nodeps
 
1000x200

声明:站长码字很辛苦啊,转载时请保留本声明及附带文章链接:https://blog.tag.gg/showinfo-3-36222-0.html
亲爱的:若该文章解决了您的问题,可否收藏+评论+分享呢?
上一篇:-bash: /usr/bin/chattr: Permission denied报错解决方法
下一篇:Ubuntu修改resolv.conf还原不生效解决方法