35

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.

Jason
  • 581
  • 1
  • 6
  • 18

2 Answers2

41
  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

enter image description here

winnervc
  • 799
  • 7
  • 10
  • I must be using v1? – Jason Aug 24 '18 at 17:49
  • 8
    NAME="Amazon Linux AMI" VERSION="2018.03" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2018.03" PRETTY_NAME="Amazon Linux AMI 2018.03" ANSI_COLOR="0;33" CPE_NAME="cpe:/o:amazon:linux:2018.03:ga" HOME_URL="http://aws.amazon.com/amazon-linux-ami/" – Jason Aug 24 '18 at 17:49
  • If v1 should I install systemd? – Jason Aug 24 '18 at 17:50
  • 2
    As far as I know I would recommend switching to any other distribution of Linux taht supports systemd if operating systemd is mandatory for your requirement. Cause I don't think it is something that you can install as a package on your OS – winnervc Aug 24 '18 at 17:59
  • 7
    @Jason I confirm that the *Amazon Linux AMI 2018.03* is an "Amazon Linux version 1" that does not come with `systemd` [Announcement: Amazon Linux 2018.03 now available](https://forums.aws.amazon.com/ann.jspa?annID=5653). So this is the reason of your issue. – Romain Sep 28 '18 at 19:54
  • 1
    yes, unfortunately we've to upgrade using amzaon 2 instead. the amazon 1 was obsolete, there'll be a lot of package error / required to use systemd – mochadwi Jul 25 '19 at 04:26
  • How do you disable a service with service. We also using a Amazon Linux v1 which does not seem to work with systemctl. All I want to achieve is to permanently stop a service without needing to uninstall. – Stephan Du Toit Feb 09 '23 at 14:05
21
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
Jamil Noyda
  • 3,321
  • 2
  • 21
  • 26