How to remove GNOME GUI from CentOS 8

This article illustrates the steps required to downgrade (or is it upgrade?) the CentOS 8 from a GNOME server with GUI to a CLI command-line mode.  I’ll show you step by step how to remove GNOME, X Window System, GUI and Graphical Administration tools from the CentOS 8 operating system.

First, let’s login as sudo:

sudo su

Then, list the groups available on the system and see if there is a default GUI group called ‘Server with GUI’:

dnf grouplist

You’ll see a list that’ll look something like this:

Now, one would think, that removing the ‘Server with GUI’ group from the Installed Environment Groups can be accomplished by simply executing the dnf groupremove “Server with GUI” command accompanied by ‘–skip-broken’ to skip uninstallable packages (so the removal wouldn’t result in removing the protected packages like sudo), like this:

dnf groupremove "Server with GUI" --skip-broken

Wouldn’t that be easy… However, that’s not the case, the way to do this in CentOS 8 is to remove the X Window System along with GNOME, using the following command:

dnf groupremove 'X Window System' 'GNOME'

The output will look like this:

Say ‘yes’ and remove the listed packaged. Once done, you’ll get a ‘Complete!’ message. This step essentially removed all packages associated with the GNOME graphical interface.

Now, to stop the GUI trying to load on boot, run:

systemctl set-default multi-user.target

This will remove /etc/systemd/system/default.target and create a symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.

Restart your server by issuing the ‘reboot’ command.

To do some further cleanup we’ll also remove Graphical Administration Tools, which we will no longer require:

dnf groupremove "Graphical Administration Tools" --skip-broken --nobest

 

Now, check the listed available groups again.

dnf grouplist

As you can see, it’ll appear that your server is still running in the ‘Server with GUI’ environmental groups, but not to worry, this is just a group under which was your server originally configured, and we’ve already stripped GNOME, X Window System, GUI and Graphical Administration tools from this group.

Your server is running in a command-line interface mode only.

Enjoy!

 

 

 


Note:

If, you experience errors during removal, such as the following Modular dependency problems during the uninstall:

Problem 1: conflicting requests
– nothing provides module(perl:5.26) needed by module perl-DBD-MySQL:4.046:8010020191114030811:073fa5fe-0.x86_64
Problem 2: conflicting requests
– nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8010020191114033549:073fa5fe-0.x86_64
Problem 3: conflicting requests
– nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8010020191113222731:16b3ab4d-0.x86_64
Warning: Module or Group ‘GNOME Desktop’ is not installed.

Uninstalling the perl-DBD packages with ‘dnf erase perl-DBD*’ won’t help. To fix the issue, you need to reset the Perl; by using the following command:

dnf module reset perl-*

The output should look like this and afterwards you can continue with the removal of GNOME.