Ubuntu – RH/CentOS service & chkconfig equivalents in Ubuntu/Debian

debianinit.dserviceUbuntu

In RedHat/CentOS distros, you start and stop services with /sbin/service:

/sbin/service httpd reload

You set whether they should run on startup with /sbin/chkconfig:

/sbin/chkconfig --levels 2345 on

What are the equivalents for a Debian-based distro like Ubuntu?

Best Answer

On Debian and Ubuntu you can run /etc/init.d scripts directly, as used to be true also on Red Hat / Centos, or use invoke-rc.d or service. I think the upstart stuff is still evolving, so this may change.

# /etc/init.d/httpd reload
# /usr/bin/service httpd reload
# /usr/sbin/invoke-rc.d httpd reload

update-rc.d is the tool corresponding to chkconfig.

# /usr/sbin/update-rc.d httpd start 20 2 3 4 5 . 80 0 1 6 .

But insserv is becoming the standard way to do this:

 # /sbin/insserv httpd,start=2,3,4,5 # 0,1,6 will be automatically set to off