centos找不到service命令的解决方法:1、利用“yum list | grep initscripts”命令,获取可安装initscripts的yum源版本;2、利用“yum install initscripts -y”命令,安装initscripts即可。

本文操作环境:centos 7系统、Dell G3电脑。
centos找不到service命令怎么办
centos系统中,如果/sbin目录下没有service这个命令,就会出现
-bash: service: command not found
的错误。
解决步骤如下:
1、输入:
# yum list | grep initscripts
会出现

CentOS Linux 7.9.2009是传统CentOS Linux 7的最后主要版本,也是很多企业历史服务器中仍可能遇到的系统版本。它以稳定、兼容RHEL 7生态、文档丰富和软件支持广泛著称,曾长期用于Web服务、数据库、虚拟化节点和企业内部业务系统。不过CentOS Linux 7已于2024年6月30日停止维护,现在继续使用会面临安全补丁缺失风险。该版本更适合旧业务迁移、历史环境恢复或离
2、上面给出了可安装软件的yum源版本。
上面是目前系统已安装的initscripts情况,因为没有了service文件,显然已经出现了错误,然后执行
# yum install initscripts
在 docker centos6 中 没有service 不太方便安装一下,命令如下:
yum install initscripts -y
安装后就有 service 了
推荐教程:《centos教程》










