Monday, December 26, 2011

Linux Start up and Run Levels

The Init Program: The kernel will start a program called init, if it finds it. The init process reads the file "/etc/inittab" 

[root@xnetbd ~]# vim /etc/inittab 

You have new mail in /var/spool/mail/root

Linux utilizes what is called "runlevels". A runlevel is a software configuration of the system that allows only a selected group of processes to exist. Init can run the system in one of eight runlevels. These runlevels are 0-6 , Runlevels 0, 1, and 6 are reserved. For Redhat Linux version 6, the runlevels are: 

0
-
halt
1
-
Single user mode
2
-
Multiuser, without NFS (The same as 3, if you don't have networking)
3
-
Full multiuser mode
4
-
unused
5
-
X11
6
-
Reboot

id:3:initdefault:(If we use 3 then our server will run with command mood window)

id:5:initdefault:(If we use 3 then our server will run with graphical window)

# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit

l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6

# Trap CTRL-ALT-DELETE
#ca::ctrlaltdel:/sbin/shutdown -t3 -r now

ca::ctrlaltdel:/sbin/shutdown -t3 -r now (Here if we un comment this line then no one can shutdown this server by using CTRL-ALT-DELETE)


The structure of a GRUB menu file :

[root@xnetbd ~]# vim /etc/grub.conf  

default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-164.el5)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.18-164.el5 ro root=LABEL=/ rhgb quiet
        initrd /boot/initrd-2.6.18-164.el5.img
    

title Microsoft Windows XP Pro
rootnoverify (hd0,0)
chainloader +1

Here we configure system start-up,if we set  default=0 then by default Linux will be loaded,on the other hand if we set default=1 then windows will be loaded