Disable the graphic login mode in CentOS 7/ RHEL 7

In CentOS-7 / RHEL-7, Systemd uses “targets” instead of run-levels, and /etc/inittab is no more used by systemd to change run levels. When the graphic interface login is installed, we will use graphic mode by default.

How can we disable the GUI login mode of CentOS-7 or RHEL-7?

Well, it’s kinda easy with the help of systemd. We only need to run commands as follows,

# mv /etc/systemd/system/default.target /etc/systemd/system/default.target.bak
# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

The first command creates a backup, and the second command sets command-line mode as default. These two commands equals to this one command,

# systemctl set-default multi-user.target

Now we can confirm current runlevel as this,

# systemctl get-default

Finally we need to reboot the system to make changes take effect,

# systemctl reboot

The way to enable graphic interface is as simple as below:

# ln -sf /etc/systemd/system/default.target.bak /etc/systemd/system/default.target

Leave a comment

Your email address will not be published. Required fields are marked *