Starting and stopping services is easy in Red Hat Enterprise Linux 6 and its derivative CentOS 6. Both includes the Service Configuration tool which simplifies service administration.

Manage Services (RHEL 6)

This section describes how to manage the services using the Service Configuration tool.

Service Configuration1. Click System, select Administration, and click Services. This will launch the Service Configuration window.
Service Configuration2. In the Service Configuration window, select the service you wish to run when the system starts and click Enable.
Service Configuration3. To immediately run the service, click Start.
ImportantMake sure xinetd is running if you enable any on demand services.

Manage Services (RHEL 5)

This section describes how to manage the services using the Service Configuration tool.

Service Configuration1. Click System, select Administration, select Server Settings and click Services. This will launch the Service Configuration window.
Service Configuration
2. In the Service Configuration window, check the service you wish to start on the next system startup, in this case the service postfix. To start the service immediately, press Start.
 
Unchecked services will not be started on the next system startup. To immediately stop a service, select the service and press Stop.
 
To restart a service, select the service and press Restart.
Service Configuration3. Press Save to save your changes.
Service Configuration4. You can also do the same for On-Demand Services.
ImportantMake sure xinetd is running if you enable any On-Demand Services. You can find xinetd in the Background Services tab.

Manage Services (Console)

Listed below are the console commands to manage the services. You need to have root level access to use the commands below.

Task
RHEL/CentOS Ubuntu
Display all the available services
/sbin/chkconfig ––list
N/A

Enable the service
/sbin/chkconfig [name] on
/usr/sbin/update-rc.d [name] defaults

Disable the service
/sbin/chkconfig [name] off
/usr/sbin/update-rc.d -f [name]
 remove

Start the background service
/sbin/service [name] start
/usr/sbin/service [name] start

Stop the background service
/sbin/service [name] stop
/usr/sbin/service [name] stop

Restart the background service
/sbin/service [name] restart
/usr/sbin/service [name] restart

Display the background service status
/sbin/service [name] status
/usr/sbin/service [name] status

Visit the forum to ask for help or to give a comment.

***
Posted on 7/20/2011 and last updated on 9/14/2011
Filed under CentOS 5 , CentOS 6 , Red Hat Enterprise Linux 5 , Red Hat Enterprise Linux 6 , System Administration , Ubuntu 10.04