Centos安装webbench时出现/bin/sh: ctags: command not found解决方法

在安装编译webbench的时候,出现如下错误信息

ctags *.c
/bin/sh: ctags: command not found
make: [tags] Error 127 (ignored)

意思是说缺少ctags命令,我没有装了,运行以下命令即可

yum install ctags

PS:关于ctags信息,可以运行命令了解一下

NAME
       ctags - Generate tag files for source code

SYNOPSIS
       ctags [options] [file(s)]

       etags [options] [file(s)]

DESCRIPTION
       The  ctags  and etags programs (hereinafter collectively referred to as
       ctags, except where distinguished) generate an index  (or  "tag")  file
       for  a  variety  of  language  objects found in file(s).  This tag file
       allows these items to be quickly and easily located by a text editor or
       other  utility.  A "tag" signifies a language object for which an index
       entry is available (or, alternatively, the index entry created for that
       object).

       Alternatively,  ctags  can generate a cross reference file which lists,
       in human readable form, information about the  various  source  objects
       found in a set of language files.

      Tag index files are supported by numerous editors, which allow the user
       to locate the object associated with a name appearing in a source  file
       and jump to the file and line which defines the name. Those known about
       at the time of this release are:

           Vi(1) and its derivatives (e.g. Elvis, Vim,  Vile,  Lemmy),  CRiSP,
           Emacs, FTE (Folding Text Editor), JED, jEdit, Mined, NEdit (Nirvana
           Edit), TSE (The SemWare Editor), UltraEdit, WorkSpace, X2, Zeus

       Ctags is capable of generating different kinds of tags for each of many
       different  languages.  For  a complete list of supported languages, the
       names by which they are recognized, and the kinds  of  tags  which  are
       generated  for each, see the --list-languages and --list-kinds options.


<think>好的,用户遇到了在Linux系统中执行命令出现/bin/sh报错'yum: not found'的问题,需要解决。首先,我需要分析可能的原因。 首先,用户使用yum命令出现未找到的错误,常见的原因有几个。第一,系统可能没有安装yum。但yum通常默认安装在基于Red Hat的发行版中,比如CentOS、Fedora或RHEL。如果用户使用的是Debian/Ubuntu系统,这些系统使用apt而不是yum,所以会提示命令不存在。这候需要确认用户的系统类型。如果是Debian系,自然不会有yum,用户应该使用apt-get或者apt命令。 第二个可能性是yum虽然安装了,但路径不在$PATH环境变量中。通常yum位于/usr/bin/yum,而/bin/sh的环境变量可能没有包含这个路径。不过这种情况比较少见,因为默认的PATH应该包含这些标准目录。用户可以通过执行'echo $PATH'来检查路径,或者用'which yum'查看yum的位置是否存在。 第三个可能是yum被误删或者损坏,或者系统出现了问题导致无法找到命令。这候需要重新安装yum包。对于CentOS等系统,可以通过rpm包管理器来重新安装yum及其依赖。 另外,用户提到的报错信息是/bin/sh: yum: not found,这说明系统在/bin/sh环境中尝试执行yum,但找不到对应的可执行文件。这可能和用户的shell环境有关,比如是否在正确的shell中执行命令,或者是否有别名覆盖。 接下来,结合用户提供的参考引用。引用1和2讨论了类似的问题,例如g++或cc命令未找到解决办法是安装对应的软件包(比如g++或build-essential)。类似地,如果yum未安装,用户需要安装yum,但需要根据系统类型来判断。 引用3提到在docker中设置环境变量的问题,可能涉及到环境变量配置错误。不过这可能和当前问题关联不大,除非用户是在docker环境中遇到yum的问题,这候需要确保镜像中安装了yum。 总结解决办法步骤: 1. 确认系统是否是支持yum的发行版(如CentOS)。如果不是,改用apt或其他包管理工具。 2. 检查yum是否安装。执行'which yum'或'rpm -q yum'。 3. 若未安装,则根据系统版本安装yum。例如,在CentOS中可能需要安装必要的仓库,然后通过rpm安装。 4. 如果系统是Debian/Ubuntu,建议用户使用apt替代yum。 5. 确保PATH环境变量包含yum的路径,通常为/usr/bin。 6. 如果yum损坏,尝试重新安装相关包。 另外,用户可能误操作导致环境变量被修改,或者使用了错误的shell,也需要检查这些情况。比如,是否在非交互式shell中执行命令,导致环境变量不同。 最后,生成相关问题需要考虑用户可能遇到的类似问题,比如其他命令未找到,或者不同发行版的包管理工具等。</think>要解决Linux系统中执行命令出现`/bin/sh: yum: not found`的问题,可按照以下步骤排查: --- ### 1. **确认系统发行版** - **Red Hat系(如CentOS、Fedora、RHEL)**:默认支持`yum`。 - **Debian系(如Ubuntu、Debian)**:使用`apt`而非`yum`,若误用`yum`会报错[^1]。 ```bash # 检查系统类型 cat /etc/os-release ``` --- ### 2. **检查`yum`是否安装** - **查看`yum`路径**: ```bash which yum # 输出应为 /usr/bin/yum ``` - **通过`rpm`验证安装**(仅限Red Hat系): ```bash rpm -q yum # 若未安装,输出 "package yum is not installed" ``` --- ### 3. **安装`yum`(仅限Red Hat系)** 若未安装,需通过以下步骤安装: ```bash # CentOS 7/8 sudo rpm --install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum update ``` --- ### 4. **Debian系系统使用`apt`替代** 若系统为Ubuntu/Debian,应使用`apt`命令: ```bash # 安装软件示例 sudo apt update sudo apt install <包名> ``` --- ### 5. **检查环境变量** 若`yum`已安装未找到,可能是`$PATH`配置问题: ```bash # 检查PATH是否包含/usr/bin echo $PATH # 临修复(将/usr/bin加入PATH) export PATH=$PATH:/usr/bin ``` --- ### 6. **修复损坏的`yum`安装** 若`yum`损坏,需重新安装: ```bash # CentOS 7 sudo rpm -e --nodeps yum sudo yum clean all sudo rpm -ivh https://vault.centos.org/centos/7/os/x86_64/Packages/yum-*.rpm ``` --- ### 总结流程图 $$ \begin{aligned} &\text{报错 '/bin/sh: yum: not found'} \\ &\downarrow \quad \text{检查系统类型} \\ &\begin{cases} \text{Red Hat系} \rightarrow \text{安装/修复yum} \\ \text{Debian系} \rightarrow \text{改用apt} \end{cases} \end{aligned} $$ ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值