Monday, May 31, 2021

CentOS 8 and RHEL 8 Runlevel : How to Change

Since CentOS 7 / RHEL 7, system run levels are replaced with targets and are managed by systemd. Systemd targets are represented by target units and their configuration files end with .target extension.

This systemd target unit file contains other systemd units through a chain of dependencies. For example, the graphical.target which provides graphical console starts GNOME service (gdm.service) and activates the multi-user.target unit.

In this guide, we will see how to change the current/default runlevel in CentOS 8 / RHEL 8.

 

Available Targets / Runlevels

CentOS 8 / RHEL 8 comes with a number of predefined targets that are more or less similar to the standard set of runlevels found in CentOS 7/ RHEL 7.



RunlevelTarget UnitsDescription
0 runlevel0.target / poweroff.target     Power off the system.
1 runlevel1.target / rescue.target     Single User mode
2 runlevel2.target / multi-user.target     multi-user mode.
3 runlevel3.target / multi-user.target     multi-user mode.
4 runlevel4.target / multi-user.target     multi-user mode.
5 runlevel5.target / graphical.target     Graphical mode.
6runlevel6.target / reboot.target    Reboot the system.









Change Default Runlevel

The default runlevel can be set either by using the systemctl command or making a symbolic link of runlevel targets to the default.target file.

1. Using systemctl Command

2. Making Symbolic link of runlevel targets

Using systemctl Command

Let’s check the current run level by running the following command

# systemctl get-default

Output:

graphical.target
 

The above output confirms that the system’s current default runlevel is graphical.target (runlevel 5).

To change the default runlevel to runlevel 3 (nothing but a multi-user.target), use the below command.

# systemctl set-default multi-user.target
 
Now reboot the system with the command
 
# reboot
 
To revert to graphical.target login as root and type the command belog:
 
# systemctl set-default graphical.target
 
again reboot the system. Now you are in graphical console.
 
Check it out using the following command in terminal again:


# systemctl get-default
 
 

 








 

Share:

0 comments:

Post a Comment