温馨提示×

ubuntu怎么设置服务开机自启动

小亿
113
2024-02-28 10:25:13
栏目: 智能运维

要设置服务开机自启动,你可以使用以下步骤:

  1. 打开终端,使用以下命令查看当前已安装的服务:
sudo systemctl list-units --type=service
  1. 找到你想要设置开机自启动的服务,使用以下命令开启自启动:
sudo systemctl enable <service-name>

例如,如果你想要开机自启动nginx服务,可以使用以下命令:

sudo systemctl enable nginx
  1. 确认服务已被开启自启动,可以使用以下命令:
sudo systemctl is-enabled <service-name>

例如,检查nginx服务是否已经开启自启动:

sudo systemctl is-enabled nginx

通过以上步骤,你可以设置Ubuntu系统中的服务开机自启动。

0