Command not found: systemctl on Amazon Linux 2018.03

China☆狼群 提交于 2019-12-03 11:36:21

问题


I am following this Amazon AWS guide to install SSL certificates. I am running Apache on AWS EC2 using the Amazon Linux AMI 2018.03. The first step in the guide is to run:

sudo systemctl is-enabled httpd

I get "bash: systemctl: command not found". I suspect maybe I am running Amazon Linux, not Amazon Linux 2.


回答1:


  1. First check what Amazon linux version you have runnng on using the command cat /etc/os-release
    1. If it is Amazon Linux Version 2, then it does support systemd and comes installed by default.
    2. If it is Amazon linux version 1, then it doesn't support cause Amazon Linux is ultimately based on an old version of CentOS/RHEL.

if it is version 1 (amazon linux), you just need to switch to any other linux distribution that supports systemd. You can't yum install systemd like a package




回答2:


sudo service nginx status

just use the service command

In earlier versions of RHEL use the service command as explained in the documentation here.

# service service_name start

Therefore, in your case:

# service iptables start

You can replace start with restart, stop, status.

List all services with:

# service --status-all


来源:https://stackoverflow.com/questions/52007149/command-not-found-systemctl-on-amazon-linux-2018-03

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!