检查服务的当前状态,以检查服务是否在系统引导时启动。
$ systemctl status apache2
使用systemctl
命令设置服务在系统启动时自启动。
$ sudo systemctl enable apache2
设置开机自启动的同时,马上启动服务。
$ sudo systemctl enable --now apache2
我们再次确认其状态:
$ sudo systemctl status apache2
要禁用服务开机自启动,使用systemctl
命令。
$ sudo systemctl disable apache2
日期:2020-07-07 20:55:40 来源:oir作者:oir