在 CentOS 6.6 上运行时出现“sudo: systemctl: command not found”

Cod*_*rPJ 14 centos systemctl centos-6.6

我正在使用 CentOS 6.6。当我尝试运行命令时

sudo systemctl start elasticsearch
Run Code Online (Sandbox Code Playgroud)

我收到这样的错误:

sudo: systemctl: command not found
Run Code Online (Sandbox Code Playgroud)

根据我的理解systemctl,CentOS 6.9 及之前版本不支持。

有人可以让我知道systemctlCentOS 6.6 版中的等价物是什么吗?

Fre*_*ers 20

您的操作系统不使用systemdsystemctl但仍使用init.dservice命令:

例如:

sudo service {servicename} {stop|start|restart}
Run Code Online (Sandbox Code Playgroud)

或者

/etc/init.d/{service} {stop|start|restart}
Run Code Online (Sandbox Code Playgroud)

请注意,即使在使用 的较新系统上systemd,您通常也可以使用该sudo service XYZ restart语法并且它仍然可以工作。