CHANGE RUNLEVEL REDHAT 7

CHANGE DEFAULT RUNLEVEL IN CENTOS 7 /REDHAT 7

In this tutorial, We are going to learn how to change the default run levels depending on our needs on Centos 7 / RedHat 7.

In Rhel 7, /etc/inittab will not be used by systemd to change run levels.Instead, Systemd uses “targets”.

There is two method in which we can change the default run levels.

  • Using systemctl
  • Making symbolic link of run level targets to default target file.

Method 1

Let’s check the current run level by using the below command:

#systemctl get-default

Output

You will see output something like this.

 

 

Before changing default run level, We have to check the list of available targets.

 

 

 

 

 

 

 

 

 

 

 

 

 

If you want to change the target use the below command:

#systemctl set-default multi-user.target

Confirm the default Run level:

#systemctl get-default

Reboot and check it.

#reboot

Method 2

We will be notified of the similar output when you executed systemctl set-default multi-user.target command.

Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

What the command did is, It makes a symbolic link of runlevel targets to default target file.

Before proceeding with the Symbolic link, Let us check the lists of files under systemd directory.

#ls -la /lib/systemd/system/runlevel*target

As per the above output, We are running run level 3.

Let us make a symbolic link of runlevel5.target to default.target file.

#ls -s /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

Now, The default run level is 5 which is a Graphical mode, Reboot the machine and check it out.

#reboot

That’s All.Hope You have learned how to change the run level on Rhel 7 / Centos 7 servers.