未找到命令:Amazon Linux 2018.03 上的 systemctl
Command not found: systemctl on Amazon Linux 2018.03
我正在关注 this Amazon AWS guide to install SSL certificates。我在 AWS EC2 上使用 Amazon Linux AMI 2018.03 运行ning Apache。指南中的第一步是 运行:
sudo systemctl is-enabled httpd
我得到 "bash: systemctl: command not found"。我怀疑我可能 运行宁亚马逊 Linux,而不是亚马逊 Linux 2.
- 首先检查您使用的亚马逊 linux 版本
命令
cat /etc/os-release
- 如果是亚马逊Linux版本2,那么
它确实支持 systemd 并默认安装。
- 如果是
Amazon linux version 1,然后它不支持 cause Amazon Linux
最终是基于旧版本的 CentOS/RHEL.
如果是版本 1(亚马逊 linux),您只需切换到支持 systemd
的任何其他 linux 发行版。你不能 yum install systemd
像一个 package
sudo service nginx status
只需使用服务命令
在早期版本的 RHEL 中使用 service
命令,如 documentation here 中所述。
# service service_name start
因此,在您的情况下:
# service iptables start
您可以将 start
替换为 restart
、stop
、status
。
列出所有服务:
# service --status-all
我正在关注 this Amazon AWS guide to install SSL certificates。我在 AWS EC2 上使用 Amazon Linux AMI 2018.03 运行ning Apache。指南中的第一步是 运行:
sudo systemctl is-enabled httpd
我得到 "bash: systemctl: command not found"。我怀疑我可能 运行宁亚马逊 Linux,而不是亚马逊 Linux 2.
- 首先检查您使用的亚马逊 linux 版本
命令
cat /etc/os-release
- 如果是亚马逊Linux版本2,那么 它确实支持 systemd 并默认安装。
- 如果是 Amazon linux version 1,然后它不支持 cause Amazon Linux 最终是基于旧版本的 CentOS/RHEL.
如果是版本 1(亚马逊 linux),您只需切换到支持 systemd
的任何其他 linux 发行版。你不能 yum install systemd
像一个 package
sudo service nginx status
只需使用服务命令
在早期版本的 RHEL 中使用 service
命令,如 documentation here 中所述。
# service service_name start
因此,在您的情况下:
# service iptables start
您可以将 start
替换为 restart
、stop
、status
。
列出所有服务:
# service --status-all