Amazon-Web-Services

如何在 Amazon Linux AMI 上啟用 systemd

  • November 17, 2020

我開始使用 Amazon Linux AMI。它似乎有**/etc/systemd/system/文件夾,但我無法使用systemctl開始停止我添加到/etc/systemd/system/**文件夾的服務。

$ systemctl
bash: systemctl: command not found

Amazon Linux v 2.0 支持 systemd 並預設安裝:

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`

遺憾的是,只有 amazon linux v2 支持 systemd。Amazon linux v1.0 沒有 https://aws.amazon.com/amazon-linux-2/

引用自:https://serverfault.com/questions/889248