如何使用centos7开机启动服务?

How start service on boot using centos7?

我在 Centos 7 上使用安装作为 init.d 服务 (System V) 的服务。

我希望重启后服务自动启动。

我该怎么做?

谢谢,我试过了:

1- /sbin/chkconfig --add my-service
2- /sbin/chkconfig --on my-service                    
3- chkconfig --list:my-service 0:off   1:off   2:on    3:on    4:on    5:on 6:off                                                          
4- /sbin/service my-service start                                         
5- reboot centos7                                                    
6- /sbin/service my-service status: Not running                          
The service does not start automatically

使用 systemd 的正确方法是:

systemctl enable myservice

如果它是一个 initv 服务,你仍然可以使用 chkconfig(也许安装它)