How to Change RunLevel on CentOS 7 / RHEL 7

Share this Article :

Old method to change the runlevel via /etc/inittab in Redhat Enterprise Linux version and CentOS server has become obsolete on RHEL 7 and CentOS 7. This latest Linux operating system uses systemd system management daemon and relies on systemctl command in order to change the runlevel. RunLevel is set with linking to /etc/systemd/system/ Please make sure you have already install Gnome GUI before you proceed to change runlevel.

1. Check the current runlevel :

# runlevel
N 3


# systemctl get-default

2. We can display the by using list command :

# ll /etc/systemd/system/
lrwxrwxrwx. 1 root root 37 Sep  1  2014 /etc/systemd/system/ -> /lib/systemd/system/

3. For example to list all currently loaded targets :

# systemctl list-units -t target
UNIT                LOAD   ACTIVE SUB    DESCRIPTION        loaded active active Basic System   loaded active active Encrypted Volumes        loaded active active Login Prompts loaded active active Local File Systems (Pre)     loaded active active Local File Systems   loaded active active Multi-User System      loaded active active Network        loaded active active Paths    loaded active active Remote File Systems       loaded active active Slices      loaded active active Sockets         loaded active active Swap      loaded active active System Initialization       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.

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

4. Type the following command to change the RunLevel to Graphical-login :

# systemctl set-default
rm '/etc/systemd/system/'
ln -s '/usr/lib/systemd/system/' '/etc/systemd/system/'

5. Verify the changed runlevel :

# runlevel
N 5


# systemctl get-default

6. Reboot the server to login to GNOME gui.

Also Read :   How to SSH Without Password on Linux


Leave a Reply