Understanding Runlevels in Linux 

Part 1

 RedHat Linux has 6 run levels. Which basically means, the Operating System (OS) can boot up in Either 6 of these run levels (i.e. modes).

0 — Halt
1 — Single-user mode
2 — not used (user-definable)
3 — full multi-user mode
4 — not used (user-definable)
5 — full multi-user mode (with an X-based login screen)
6 — Reboot

The default runlevel for a system to boot to and stop is configured in /etc/inittab.
(So if your default runlevel is set to 0 or 6, you pretty much in dog poop)

You should have a line close to the top like:

            id:3:initdefault:

This means your computer boots into run level 3 by default.

If you type in as ROOT.

$ chkconfig –list |more

You can see a list of services that start up at boot time (actually the start up scripts are the ones that start up these services but anyway). The last 6 columns represent the 6 different run levels discussed above.

The Rows are service names..

keytable        0:off   1:on    2:on    3:on    4:on    5:on    6:off

Can be interpreted as follows

Runlevel 0 and 6 service keytable is turned off.

Runlevel 1, 2, 3, 4 and 5 service keytable is turned on.


To enable a service use the following syntax

$ chkconfig serviceName on

To disable a service use the following syntax

$ chkconfig serviceName off

Depending on the service you enabled (I mean if it’s a service that should only be   used by users in Multi-User mode, and not in Single-User mode) the service will be started.

Understanding what chkconfig does for you, under its black robe.

There is a init.d directory which has the initializing scripts for different applications installed on your computer. And the 6 rc directories which basically have links to the initializing scripts in the rc#.d directory.

init.d
rc0.d
rc1.d
rc2.d
rc3.d
rc4.d
rc5.d
rc6.d

These directories represent the 6 runlevels and contain the startup scripts of different applications that need to be started or Killed at boot time. Each directory has the exact same startup scripts except for one small difference. rc0.d and rc6.d contain all the same scripts that begin with a “k” which stands for KILL.
What chkconfig basically does when you ask it turn a service on or off, is it renames the filenames of the specified service either from kserviceName to sserviceName or vice versa. Thus either turning a service on or turning it off.

----------------------------------------------------------------------------------------------------
CHANGE THE DEFAULT RUNLEVEL:

pico -w /etc/inittab

You should see a line:
id:5:initdefault:

Edit it to:
id:3:initdefault: