Add a package to startup on Debian/ Ubuntu/ Red Hat/ CentOS

Add a package to startup on Debian/ Ubuntu/ Red Hat/ CentOS

Get Social!

Linux penguin Most versions and distributions of Linux today have a start up manager application to easily set which programs are started when your Linux machine boots up. There are two distinct flavours of start up applications and a manual method for distributions without this feature installed.

Using a terminal and the command chkconfig on CentOS, Red Hat and Oracle Enterprise Linux; and update-rc.d on Debian and Ubuntu you can control which packages are available as services and which packages start with your computer.

Run Level

Before looking at the commands used to control startup services in Linux, it’s important to understand when a program should be running in relation to the current operating system state. For example, you probably don’t want your Apache service being started before you have networking.

Linux has the concept or a runlevel which dictates the state of the operating system as a number between 0 and 6 inclusive.

See my post on runlevels to understand when your application or service should be asked to start.

Start up with Red Hat, CentOS and Oracle Enterprise Linux

Controlling startup services in Linux distributions such as Red Hat Enterprise Linux (RHEL), CentOS and Oracle Enterprise Linux (OEL) is done using the chkconfig command.

See my chkconfig cheat sheet for more information on controlling startup services on RHEL based Linux.

Start up with Debian and Ubuntu

Debian and Ubuntu based Linux distributions use the command update-rc.d to control which services are started during machine boot.

For details of controlling such services, see my update-rc.d cheat sheet.

Start up for manually setting the start up services

For operating systems that are not managed by an application, such as upstart on Ubuntu, you will need to manually add the /etc/init.d/ start up script to the /etc/rc.local file.

The /etc/rc.local file contains a reference to all the services which are required on machine boot.

Run the below echo command to add a manual start up application. The application name must be the same as the /etc/init.d/ file which must exist.

echo "network" >> /etc/rc.local

To remove a service, edit the /etc/rc.local file and manually remove the service name.

vi /etc/rc.local


Leave a Reply

Visit our advertisers

Quick Poll

Do you use ZFS on Linux?

Visit our advertisers