It is different between Amazon Linux 1 and Amazon Linux 2.
Amazon Linux 1
In AmazonLinux1, use chkconfig
command.
$ sudo chkconfig mysqld on
$ sudo chkconfig httpd on
Amazon Linux2
In AmazonLinux2, systemd was introduced. So, chkconfig
is legacy command. You should use systemctl
. It is a control command for systemd.
$ sudo systemctl enable mysqld
$ sudo systemctl enable httpd
You can confirm it is enabled or not using by is-enabled
command.
$ sudo systemctl is-enabled mysqld
enabled
chkconfig
command request will be forwarded to systemctl
.
$ chkconfig mysqld on
Note: Forwarding request to 'systemctl enable mysqld.service'.