How To Install GNOME GUI In CentOS 7 Linux

How To Install GNOME GUI In CentOS 7 Linux

Step 1

Install Gnome GUI packages using the YUM command.

CentOS 7:

# yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

Step 2

Enable GUI on system startup. In CentOS 7 / RHEL 7,  systemd uses “targets” instead of runlevel. The /etc/inittab file is no more used to change run levels. So, issue the following command to enable the GUI on system start.

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

Step 3

Start The GUI

By default after installing the “GNOME Desktop” group of packages, the default target will not have changed, meaning that after a reboot the GUI will not automatically be loaded. We can check the current default target as shown below.

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

The target is similar to the old run levels, in this case multi-user.target is equivalent to run level 3 meaning that after a reboot the GUI will not be loaded here. We instead set the default to the graphical.target which is equivalent to run level 5.

[root@centos7 ~]# systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.

[root@centos7 ~]# systemctl get-default
graphical.target

While this has changed the default target which is accessed during system boot, our current target is still the multi-user.target. We can change to the GUI by performing ‘systemctl isolate graphical.target’ which will change us to the GUI immediately.

[root@centos7 ~]# systemctl isolate graphical.target

Alternatively a system reboot would also work, as all future boots should boot to the graphical target by default.

Removing The GUI

If you’ve installed the GUI on a server and realized that it was a terrible mistake, don’t worry! We can also undo this by simply using yum to remove the “GNOME Desktop” package group

[root@centos7 ~]# yum groupremove "GNOME Desktop"

Carefully read through the packages that will be removed and ensure that this looks correct prior to removing packages or dependencies.