Tags

Change Default runlevel in RHEL/CentOS and clones

One of the nice things about Fedora/Red Hat and derivatives like Centos is how easy it is to change run levels. Do some work within a GUI (set up a webserver for example) and then run it headless for maximum efficiency. Fedora/RH/CentOS and friends have a total of 7 run levels, all of which are explained below:

0 - halt, aka 'off'. If you type 'init 0' at the command line, your Linux box will start to shut down.

1 - single user mode, command line only, no networking.

2 - multi user mode without networking.

3 - full multiuser mode. This is the level you want for a headless server. Networking is enabled, command line only.

4 - unused. No use to anyone whatsoever.

5 - X11. Here's your GUI mode! Mouse, icons - you can breathe again!

6 - reboot. Typing init 6 into terminal (as root) will reboot your Linux box.

So, now you know the levels, how do you make your Fedora/RH box boot up into one of them (never into level 0 though!)?

Go into terminal, switch to root (type 'su' and enter the password) and then 'gedit /etc/inittab'. Replace gedit with whatever text editor you want - vi or leafpad will do the same job. Look for the line:

id:5:initdefault:

Once there, change the number to whatever runlevel you desire. Reboot. You can change the runlevel from the command line whenever you want - as root simply type 'init X', where X is the runlevel you want.

Posted by

Share: