Search Engine

Loading

Sallar

Sallar
RedhatEnterpriseLinux Blog

How to Runlevels in RHEL


How does the system know which initialization scripts to run so that only the desired services are started at boot time? Linux uses the concept of runlevels to define which services to start at boot time. There are 7 runlevels, with each having its own general purpose:
 0: Halt the system or Shutdown
 1: Single-user mode (For system recovery & restore mode)
 2: Not used
 3: Multi-user mode with text login
 4: Not used
 5: Multi-user mode with graphical login
 6: Reboot

Each runlevel has its own directory named rcX.d in /etc/rc.d/, where X is the runlevel number. Each of these directories contains symbolic links to the actual initialization scripts in /etc/rc.d/init.d/. Each symbolic link start with the letter S or K followed by a number. The S stands for start, and the K stands for kill, which means to stop a process. When a runlevel is initialized, all the services starting with K are stopped first, and then all the services starting with S are started. The number following the letter determines the order in which the stop and start actions are performed. The lower the number, the sooner it is executed.
Changing the Default Runlevel
By default, Red Hat Enterprise Linux boots into runlevel 5 with a graphical login screen and a graphical desktop once the user successfully authenticates. Runlevel 3 is essentially the same except the text login is used. Runlevels 2 and 4 are not reserved for a specific mode, but they can be defined for specific purposes if needed.
The default runlevel is configured on the following line from the /etc/inittab file:
id:5:initdefault:
To change the default runlevel, modify this line. The next time the system is booted, it is booted into the new default runlevel. To change to a different runlevel without rebooting the system, execute the following command as root, where <runlevel> is a number from 0 to 6: init <runlevel>

0 comments:

Post a Comment

Powered by Blogger.

Ads

 
Copyright © Redhat Enterprise linux. Original Concept and Design by My Blogger Themes
My name is Abdul Razaq but people call me Raziq. Here is my home page: www.redhatenterpriselinux.blogspot.com I live in Quetta, Pakistan and work as an IT-Engineer.