Changing Default Runlevel in Centos/RHEL 6 & 7

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.

Centos/RHEL 6

Changing default runlevel in Centos/RHEL 6 is very easy task & requires a change in single file.

Firstly, open file /etc/inittab

vim /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.

id:3:initdefault:

Note:- You must never use 0 (halt) as default runlevel.

 

Centos/RHEL 7

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

systemctl list-units –type=target

and output should be like ,

Default runlevel

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,

systemctl set-default multi-user.target

and that’s it, your runlevel is changed. You can verify if the runlevel is changed by running following comamnd

systemctl get-default

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.

 

If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money:

Linux TechLab is thankful for your continued support.

Shusain

Passionate about Linux & open source. Loves to learn, read & write about Linux as well as new technologies.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *