e Learning

Change Runlevel in CentOS 7 using Systemd Target

In Linux, runlevels are several different modes that a Linux system can run. In CentOS 7 runlevels called as systemd targets. In this tutorial we are going to learn how change runlevels in CentOS 7 using systemctl command.

Runlevels in CentOS 7 identified little bit  differently compared to previous version CentOS 6, even though the basic concept is still the same. In CentOS 7 runlevels are called as systemd targets.

CentOS 7 systemd targets

You can get the list of all available systemd targets on your CentOS 7 system using the following command.

systemctl list-units –type=target -all

Some of the most important systemd targets are,

Change Default Systemd target(runlevel) in CentOS 7

First of all find out what is the current default systemd target in your CentOS 7 server, using systemctl get-default command.

systemctl get-default

To change the default runlevel we use systemctl command followed by set-default, followed by the name of the target.

systemctl set-default target-name

For example, if you want to change default runlevel to multi user mode,

systemctl set-default multi-user.target

Next time you reboot the system, the system will run in multi user mode.

Change Runlevel in CentOS 7 using Systemd Target

Switch between runlevels (systemd targets) in CentOS 7

We can also switch between runlevels without rebooting the system while we are working and without changing the default runlevel.

To switch between systemd target we sue systemctl command followed by isolate, followed by the target.

systemctl isolate multi-user.target

The Command will switch your CentOS 7 server to multi user mode immediately.