If you are running a CentOS 7/8 or RHEL7/8 in your environment with minimal installation and for want to install a graphical desktop for some reason, it is a very easy process. Thanks to the yum grouplist and the yum groupinstall commands, which are very powerful commands that save you precious time by installing group of packages easily without the need to install packages individually.
By using yum groups, it’s not necessary to manually install related packages one by one, and we will use this feature to install the GUI desktop environment in my CentOS 8 server running with minimal installation.
The current systemctl target in my running system is multi-user.target, which is the equivalent of runlevel 3, Text mode in systemd. We can check this with below command
$ systemctl get-default multi-user.target
The two most common targets are:
- multi-user.target: analogous to runlevel 3, Text mode
- graphical.target: analogous to runlevel 5, GUI mode with X server
After the GUI desktop is installed, we will need to change the default multi-user.target to graphical.target to allow the system to boot by default on the graphical target. We will see how to do this later in this post.
First, list all available package groups with the yum grouplist command
$ yum grouplist CentOS-8 - AppStream 1.2 kB/s | 4.3 kB 00:03 CentOS-8 - Base 1.5 kB/s | 3.9 kB 00:02 CentOS-8 - Extras 583 B/s | 1.5 kB 00:02 Available Environment Groups: Server with GUI Server Workstation Virtualization Host Custom Operating System Installed Environment Groups: Minimal Install Available Groups: Container Management .NET Core Development RPM Development Tools Smart Card Support Development Tools Graphical Administration Tools Headless Management Legacy UNIX Compatibility Network Servers Scientific Support Security Tools System Tools
As you can see from below output, the current installed environment group is “Minimal Install” and one of the available groups to install is “Server with GUI“. We can dig further by displaying the subgroups that will be installed with a specific group, we can use the yum groupinfo “Group Name” command.
For example, to list the available packages grouped in the “Server with GUI”, use below command.
$ yum groupinfo "Server with GUI" Last metadata expiration check: 0:16:40 ago on Sat 16 Nov 2019 09:38:21 PM +04. Environment Group: Server with GUI Description: An integrated, easy-to-manage server with a graphical interface. no group 'dns-server' from environment 'graphical-server-environment' Mandatory Groups: Common NetworkManager submodules Container Management Core Fonts GNOME Guest Desktop Agents Hardware Monitoring Utilities Hardware Support Headless Management Internet Browser Multimedia Printing Client Server product core Standard Optional Groups: Basic Web Server Debugging Tools FTP Server File and Storage Server Guest Agents Infiniband Support Mail Server Network File System Client Network Servers Performance Tools Remote Desktop Clients Remote Management for Linux Virtualization Client Virtualization Hypervisor Virtualization Tools Windows File Server
The above output shows the mandatory groups and the optional groups to be installed. One of the mandatory groups listed is GNOME, so we can assume that the GNOME desktop will be installed while installing the “Server with GUI” group, along with other administration tools like “Internet Browser”, “Multimedia”, …etc.
Let’s go ahead and install the “Server with GUI” group with yum groupinstall command. Below command will install all other mandatory groups listed above. If you wish to install only the GNOME environment, type “GNOME” instead of “Server with GUI”
$ sudo yum groupinstall "Server with GUI" -y
Output
CentOS-8 - AppStream 1.1 kB/s | 4.3 kB 00:04 CentOS-8 - Base 2.0 kB/s | 3.9 kB 00:01 CentOS-8 - Extras 949 B/s | 1.5 kB 00:01 no group 'dns-server' from environment 'graphical-server-environment' No match for group package "hpijs" No match for group package "centos-release-eula" Dependencies resolved. ================================================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================================================= Installing group/module packages: PackageKit-command-not-found x86_64 1.1.12-2.el8 AppStream 27 k PackageKit-gstreamer-plugin x86_64 1.1.12-2.el8 AppStream 18 k PackageKit-gtk3-module x86_64 1.1.12-2.el8 AppStream 18 k abattis-cantarell-fonts noarch 0.0.25-4.el8 AppStream 155 k alsa-plugins-pulseaudio x86_64 1.1.6-3.el8 AppStream 49 k ... udisks2-iscsi x86_64 2.8.0-2.el8 AppStream 45 k udisks2-lvm2 x86_64 2.8.0-2.el8 AppStream 69 k webkit2gtk3-plugin-process-gtk2 x86_64 2.22.6-1.el8 AppStream 11 M p11-kit-server x86_64 0.23.14-5.el8_0 BaseOS 236 k Enabling module streams: container-tools rhel8 llvm-toolset rhel8 perl-DBD-SQLite 1.58 perl-DBI 1.641 python36 3.6 virt rhel Installing Environment Groups: Server with GUI Installing Groups: Container Management Core Fonts GNOME Guest Desktop Agents Hardware Monitoring Utilities Hardware Support Headless Management Internet Browser Multimedia Common NetworkManager submodules Printing Client Server product core Standard Transaction Summary =============================================================================================================================================================== Install 756 Packages Total download size: 696 M Installed size: 2.1 G Downloading Packages: (1/756): PackageKit-gstreamer-plugin-1.1.12-2.el8.x86_64.rpm 23 kB/s | 18 kB 00:00 (2/756): PackageKit-gtk3-module-1.1.12-2.el8.x86_64.rpm 45 kB/s | 18 kB 00:00 (3/756): PackageKit-command-not-found-1.1.12-2.el8.x86_64.rpm 20 kB/s | 27 kB 00:01 (4/756): accountsservice-0.6.50-6.el8.x86_64.rpm 78 kB/s | 109 kB 00:01 (5/756): abattis-cantarell-fonts-0.0.25-4.el8.noarch.rpm 79 kB/s | 155 kB 00:01 (6/756): accountsservice-libs-0.6.50-6.el8.x86_64.rpm ... (130/756): gnome-initial-setup-3.28.0-8.el8.x86_64.rpm 406 kB/s | 1.3 MB 00:03 (131/756): gnome-keyring-3.28.2-1.el8.x86_64.rpm 267 kB/s | 934 kB 00:03 (132/756): gnome-keyring-pam-3.28.2-1.el8.x86_64.rpm 33 kB/s | 47 kB 00:01 (133/756): gnome-logs-3.28.5-3.el8.x86_64.rpm 202 kB/s | 1.0 MB 00:04 (134/756): gnome-menus-3.13.3-10.el8.x86_64.rpm 161 kB/s | 187 kB 00:01 (135/756): gnome-online-accounts-3.28.0-1.el8.x86_64.rpm 188 kB/s | 547 kB 00:02 (136-137/756): gnome-getting-started-docs-3.28.2-1.el8.noarch.r 21{a30ec6af4236f4179fdacbfa14163c342445d6f2c9798eae9caee1ef22a84454} [============= 1.0 MB/s | 149 MB 09:12 ETA ... (618/756): xdg-desktop-portal-gtk-1.0.2-1.el8.x86_64.rpm 69 kB/s | 181 kB 00:02 (619/756): xdg-user-dirs-0.17-1.el8.x86_64.rpm 97 kB/s | 65 kB 00:00 (620/756): xdg-user-dirs-gtk-0.10-13.el8.x86_64.rpm 87 kB/s | 73 kB 00:00 (621/756): xorg-x11-drv-fbdev-0.5.0-2.el8.x86_64.rpm 78 kB/s | 27 kB 00:00 (622/756): xorg-x11-drv-libinput-0.28.0-2.el8.x86_64.rpm 58 kB/s | 50 kB 00:00 (623/756): xorg-x11-drv-vesa-2.4.0-3.el8.x86_64.rpm 46 kB/s | 31 kB 00:00 (624/756): xorg-x11-font-utils-7.5-40.el8.x86_64.rpm 73 kB/s | 103 kB 00:01 (625-627/756): xorg-x11-server-Xorg-1.20.3-5.2.el8_0.x86_64.rpm 93{a30ec6af4236f4179fdacbfa14163c342445d6f2c9798eae9caee1ef22a84454} [================================ ] 736 kB/s | 653 MB 00:59 ETA ... (754/756): xmlrpc-c-client-1.51.0-5.el8.x86_64.rpm 80 kB/s | 40 kB 00:00 (755/756): wpa_supplicant-2.7-1.el8.x86_64.rpm 203 kB/s | 1.7 MB 00:08 (756/756): perl-interpreter-5.26.3-416.el8.x86_64.rpm 182 kB/s | 6.3 MB 00:35 ---------------------------------------------------------------------------------------------------------------------------------------------------------- Total 611 kB/s | 696 MB 19:25 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : atk-2.28.1-1.el8.x86_64 1/756 Installing : perl-Exporter-5.72-396.el8.noarch 2/756 Installing : perl-libs-4:5.26.3-416.el8.x86_64 3/756 Installing : perl-Carp-1.42-396.el8.noarch 4/756 Installing : libjpeg-turbo-1.5.3-7.el8.x86_64 5/756 Installing : gstreamer1-1.14.0-3.el8.x86_64 6/756 Installing : libXfixes-5.0.3-7.el8.x86_64 7/756 Installing : libXdamage-1.1.4-14.el8.x86_64 8/756 ... usermode-1.113-1.el8.x86_64 userspace-rcu-0.10.1-2.el8.x86_64 wpa_supplicant-1:2.7-1.el8.x86_64 xml-common-0.6.3-50.el8.noarch xmlrpc-c-1.51.0-5.el8.x86_64 xmlrpc-c-client-1.51.0-5.el8.x86_64 Complete!
Once the installation is completed, change the default system target to graphical.target to make the system boot on GUI interface by default, then reboot the system.
$ sudo systemctl set-default graphical.target [sudo] password for mourad: Removed /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
$ sudo systemctl reboot
After the system is rebooted, go through the GNOME initial configuration wizard and you’re good to go with you CentOS 8 Graphical installation.
CentOS 8 with GNOME is ready to be used!
If you would like to revert back the system to boot to the text mode as the default target, use below command.
$ sudo systemctl set-default multi-user.target Removed /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target.
To uninstall the GUI desktop from your system, use the yum groupremove command to uninstall GNOME then reboot your system.
sudo yum groupremove "GNOME" -y Dependencies resolved. ========================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================= Removing: ModemManager x86_64 1.8.0-1.el8 @BaseOS 3.0 M NetworkManager-adsl x86_64 1:1.14.0-14.el8 @BaseOS 54 k PackageKit-command-not-found x86_64 1.1.12-2.el8 @AppStream 50 k PackageKit-gtk3-module x86_64 1.1.12-2.el8 @AppStream 28 k at-spi2-atk x86_64 2.26.2-1.el8 @AppStream 247 k at-spi2-core x86_64 2.28.0-1.el8 @AppStream 502 k ... xorg-x11-xinit-1.3.4-18.el8.x86_64 xorg-x11-xkb-utils-7.7-27.el8.x86_64 yelp-libs-2:3.28.1-3.el8.x86_64 yelp-xsl-3.28.0-2.el8.noarch zenity-3.28.1-1.el8.x86_64 Complete!
$ sudo systemctl reboot
That’s it for this post. Thanks for reading!