How to enable systemd on Amazon Linux AMI

53,322

Solution 1

Amazon Linux v 2.0 does support systemd and comes installed by default:

cat /etc/os-release
NAME="Amazon Linux"
VERSION="2.0 (2017.12)"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2.0"
PRETTY_NAME="Amazon Linux 2.0 (2017.12) LTS Release Candidate"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2.0"
HOME_URL="https://amazonlinux.com/"

rpm -qa | grep -i systemd
systemd-libs-219-42.amzn2.4.x86_64
systemd-219-42.amzn2.4.x86_64
systemd-sysv-219-42.amzn2.4.x86_64`

Solution 2

sadly that only amazon linux v2 support systemd. Amazon linux v1.0 does not https://aws.amazon.com/amazon-linux-2/

Solution 3

Amazon Linux is ultimately based on an old version of CentOS/RHEL and doesn't support systemd.

https://forums.aws.amazon.com/message.jspa?messageID=731256

Solution 4

So even though "Amazon Linux 2" should have this command by default, the docker image for it – amazonlinux:2 – does not. To install it there use this directive:

FROM amazonlinux:2
RUN yum install -y /usr/bin/systemctl
Share:
53,322

Related videos on Youtube

Saqib Ali
Author by

Saqib Ali

UI/UX Designer for an open source Ideas Bank

Updated on September 18, 2022

Comments

  • Saqib Ali
    Saqib Ali almost 2 years

    I started using Amazon Linux AMIs. It seems to have the /etc/systemd/system/ folder, but I am not able to use systemctl to start stop a service I added to the /etc/systemd/system/ folder.

    $ systemctl
    bash: systemctl: command not found
    
  • Michael Hampton
    Michael Hampton over 6 years
    That thread is funny. AFAIK the only people who "want" Amazon Linux are internal to Amazon. And maybe not even there.
  • Tim
    Tim over 6 years
    @MichaelHampton but now there's Amazon Linux 2, which will be awesome!!!1! I noticed that there have been very few updates to Amazon Linux 1 recently.
  • overexchange
    overexchange over 4 years
    Does amazon Linux v2 also support SYSVinit?
  • Michael Hampton
    Michael Hampton almost 4 years
    Amazon Linux 1 is obsolete, and so is that tutorial.
  • Michael Hampton
    Michael Hampton almost 4 years
    Amazon Linux 1 is obsolete.
  • Manish
    Manish almost 4 years
    I agree that it is obsolete, but when I had to configure my app on a server which is using the obsolete version, I was not able to do it through systemctl. So I shared the answer with others.
  • Michael Hampton
    Michael Hampton over 3 years
    This is not surprising. Docker images are not expected to contain systemd or any other init system, only your application.