Friday, September 2, 2011

Redhat Linux Runlevels

The order in which Linux starts system services is governed by what runlevel is assigned to the service in question. Some runlevels will boot or halt the system itself, while others control regular system services or even programs that the administrator installs and wants started at a particular time in the boot cycle. These runlevels are controlled with scripts that are defined by runlevel named directories in which they reside. The default runlevel for the system is set in the /etc/inittab file, but it can be overridden from the GRUB boot loader menu. Redhat Enterprise Linux has six runlevels.

Runlevel 0: Halt the system. When the system is sent to this runlevel, everything shuts down and the system is completely halted. If the computer's BIOS supports it, the machine is powered off at the end of the process.

ENTERPRISE PORTAL

Runlevel 1: This is single user mode. In single user mode an administrator can do all sorts of maintenance, like backups, restores, and repairs. This is useful because no other users can be logged in and the system is not prone to having others change things, which is important when this sort of work is being done. Networking is not enabled so the network interfaces and infrastructure are offline.

Runlevel 2: In this runlevel, multiuser functionality is enabled with only some networking services enabled.

Runlevel 3: Multiuser mode is enabled with full networking functionality.

Runlevel 4: This runlevel is currently not used.

Runlevel 5: The X Windows graphical user interface system is enabled and the user is brought to a graphical login screen. After logging in, the user is taken to their graphical desktop as in all of the popular operating systems of today. Networking is fully enabled.

Runlevel 6: This is the reboot runlevel. It does what it says and reboots the system. You should never set the /etc/inittab default runlevel to number 6 for obvious reasons. Your system would be in an endless reboot loop.

Each runlevel has a bunch of scripts associated with it. Runlevel 3 scripts are located in the /etc/rc.d/rc3.d directory. The runlevel directories are rc0.d through rc6.d, and they are all located under the /etc/rc.d directory. Whatever the default runlevel is set to in the /etc/inittab file, the system will look in the appropriate runlevel directory and execute the scripts in numeric order, starting and killing services according to the scripts. The start scripts start with an "S" and the kill scripts with a "K". The scripts in the runlevel directories are really just symbolic links to the real script files in the /etc/rc.d/init.d directory. The /etc/rc.d/ rc(number).d directory is hard linked to /etc/rc(number).d directory, so you can use the shorter one to get to the same place.

Knowing about Linux runlevels is an important part about knowing how to handle a Linux system, and the knowledge translates to UNIX systems as well. There will be minor and subtle differences, such as varying directory names and different boot loaders, but it is essentially the same framework.

Redhat Linux Runlevels

Tom has worked for technology companies for 15+ years starting as a software quality assurance tech and migrating over to IT as a UNIX, Linux, and Windows systems operator and administrator. The Techbait technology and tech products portal is the place to be for geeks on the go. http://techbait.net

ENTERPRISE PORTAL

0 comments:

Post a Comment