How To Change Runlevels In Centos7

Centos-Logo

This Maybe be useful for the users familiar with Centos 6. Because on 7, the way is totally different to switch between run-levels.

Method 1

Check Runlevel:

[root@localhost ~]# systemctl get-default
multi-user.target

You can compare this level with old runlevel3 (text mode).

List Runlevels on your system:

UNIT                LOAD   ACTIVE SUB    DESCRIPTION
basic.target        loaded active active Basic System
bluetooth.target    loaded active active Bluetooth
cryptsetup.target   loaded active active Encrypted Volumes
getty.target        loaded active active Login Prompts
graphical.target    loaded active active Graphical Interfac
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target     loaded active active Local File Systems
multi-user.target   loaded active active Multi-User System
network.target      loaded active active Network
paths.target        loaded active active Paths
remote-fs.target    loaded active active Remote File Systems
slices.target       loaded active active Slices
sockets.target      loaded active active Sockets
sound.target        loaded active active Sound Card
swap.target         loaded active active Swap
sysinit.target      loaded active active System Initialization
timers.target       loaded active active Timers

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

16 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Switch to Other runlevel (example = Graphical=runlevel5).

systemctl set-default graphical.target

Reboot to take effect to this runlevel.

Method 2

Check your current runlevel:

[root@localhost ~]# ls -altr  /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 37 Sep 17 06:29 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target
[root@localhost ~]# 

Check list of the runlevels:

[root@localhost ~]# ls /lib/systemd/system/runlevel*target -l
lrwxrwxrwx. 1 root root 15 Sep 17 06:28 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Sep 17 06:28 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Sep 17 06:28 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Sep 17 06:28 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Sep 17 06:28 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Sep 17 06:28 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Sep 17 06:28 /lib/systemd/system/runlevel6.target -> reboot.target

Switch to Other runlevel:

rm /etc/systemd/system/default.target
ln -s  /lib/systemd/system/runlevel5.target  /etc/systemd/system/default.target

Or,

ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target

Check if runlevel changed:

systemctl get-default

Reboot. That’s it.