How to Autostart Services In Red Hat, CentOS, and Fedora

On a Linux dedicated server, certain applications can run as daemons. These are programs that begin running when the server boots and remain in the memory for the duration of the server’s uptime. Normally, when you install one of these programs, the system will automatically add them to the appropriate directories, such as “/etc/rc.d/init.d”.

There are a couple of ways to configure services on Red Hat Enterprise Linux, CentOS and Fedora. One is to use the ncurses setup program called “ntsysv” that comes with each of these Linux distributions. It is semi-graphical, even though you can run it from the command line and even remotely via SSH. As root, type “setup” from the command prompt.

ntsysv setup

The menu will give you several options, the fourth of which is “system services”. Select it, and you will be presented with a list of currently-installed services. (Note: If a program has not been installed as a daemon or service, it will not appear here. To manually do so is the topic of another discussion entirely).

Those services that are currently running will have an “x” in the boxes next to them. Use the space bar to select any services you want to enable or disable.

Another tool you can use from the command line is chkconfig. To find out which services are running, type:

chkconfig –list

To start  a service a boot type:

chkconfig name-of-service on

To stop a service from running at boot, type:

chkconfig name-of-service off

You can also configure a service for specific runlevels.  For example:

chkconfig –level 345 name-of-service on

This will start the service on runlevels 3, 4, and 5, but not on others.

For more information about chkconfig, you can read the online documentation.  You can also read online documentation for ntsysv.