Hello Linux-Fanatics, in this post we will be process for changing default runlevel in Centos\RHEL 6 & 7 . But before we do that, we must discuss following...
What is a runlevel ?
Runlevel is the preset state in which a Linux system operates. Below mentioned are the different runlevels of a Linux system in which a linux system can be operated
- 0- halt or shutdown
- 1- single user mode
- 2- multi user mode without NFS
- 3- full multi-user mode
- 4- not used
- 5- graphical mode
- 6- reboot
Now, lets learn how to change the default runlevel.
Changing default runlevel in Centos/RHEL 6 is very easy task & requires a change in single file.
Firstly, open file /etc/inittab
and you will get something like id:5:initdefault: in the file, where 5 is the default runlevel.
You must change 5 to desired runlevel, which in this case is 3 (multi-user mode). After making changes to file, save it to change the default runlevel on boot.
Note:- You must never use 0 (halt) as default runlevel.
Changing runlevel in Centos/RHEL 7 is bit tricky as /etc/inittab is no more used by systemd to change the run levels. Also, runlevels are also defined differently in Centos/RHEL 7.
Firstly let’s check all the available runlevels, to do so run the following command
and output should be like ,
so, these are all the runlvels available in Centos/RHEL 7.
Now if you want to change default runlevel to 3 which is ‘multi-user.target’, run following command,
and that’s it, your runlevel is changed. You can verify if the runlevel is changed by running following comamnd
So, that concludes our tutorial on changing default runlevel, i hope it was easy & descriptive enough to be followed. There are many other tips & tricks tutorial HERE, please look through.
Also, if you have any queries or questions, mention them in the comment box below & I will surely get back to you.