DEV Community

Cover image for How to Install Gnome/KDE (GUI) on Ubuntu/CentOS
FlatlinerAtheist | CLI-NERDS
FlatlinerAtheist | CLI-NERDS

Posted on Originally published at clinerds.com

How to Install Gnome/KDE (GUI) on Ubuntu/CentOS

Users who prefer a graphical desktop can install GNOME or KDE Plasma on Ubuntu or a CentOS/RHEL-compatible system. A desktop is useful for a local console or a deliberate remote-desktop setup, but it is not required to administer a server. Choose it for a specific workflow, not just because a server happens to need a few configuration changes.

Before installing: resources and access

Check the release, available resources, and current boot mode first:

cat /etc/os-release
free -h
df -h /
systemctl get-default
Enter fullscreen mode Exit fullscreen mode

A full desktop can pull in hundreds of packages, extra disk usage, memory-resident services, and a larger stream of updates. The exact cost depends on the release and selected applications; a small virtual machine can feel the difference even when the desktop is idle. Take a snapshot or backup and confirm that you still have console or out-of-band access before changing a remote machine. A GUI does not improve the performance of the services running underneath it.

Install GNOME or KDE on Ubuntu

Use a regular account with sudo rather than running a desktop as root. Refresh the package indexes and apply updates before installing:

sudo apt update
sudo apt full-upgrade
sudo apt install tasksel
Enter fullscreen mode Exit fullscreen mode

tasksel provides distribution-tested desktop collections. Run sudo tasksel and select Ubuntu desktop for GNOME or Kubuntu desktop for KDE Plasma. Selecting both installs two large environments and can make display-manager and default-session choices confusing. The equivalent package-based choices are:

sudo apt install ubuntu-desktop
# or, for KDE Plasma:
sudo apt install kubuntu-desktop
Enter fullscreen mode Exit fullscreen mode

These metapackages include applications as well as the desktop. To request fewer recommended extras, the original guide's approach still works when you understand the trade-off:

sudo apt install --no-install-recommends kubuntu-desktop
Enter fullscreen mode Exit fullscreen mode

This is not a minimal-desktop guarantee: omitted components may include useful integration or applications. If installation asks for a display manager, GDM3 is the usual GNOME choice and SDDM is the usual KDE choice. Either can often start other sessions, but using the matching default reduces surprises.

Install a GUI on CentOS and RHEL-compatible systems

CentOS 7 and CentOS Linux 8 are end-of-life. For a maintained RHEL-compatible release, inspect the available groups instead of assuming that old CentOS group names still exist:

sudo dnf group list --hidden
sudo dnf group install "Server with GUI"
Enter fullscreen mode Exit fullscreen mode

On releases providing that environment, this installs GNOME and its display manager. KDE packaging and group names vary between distributions and repositories; use the target distribution's documented KDE packages rather than copying a CentOS 7 command. If dnf cannot find the group, verify the enabled repositories and OS release before adding third-party repositories.

Select graphical boot and check the display manager

Installing packages does not always change the next boot target. Set the graphical target explicitly, then reboot during a maintenance window:

sudo systemctl set-default graphical.target
sudo reboot
Enter fullscreen mode Exit fullscreen mode

To switch without rebooting, sudo systemctl isolate graphical.target changes targets immediately, but can terminate sessions and services; use it only when that disruption is acceptable. To return to a text-based server at the next boot, use sudo systemctl set-default multi-user.target.

Check both the target and the login screen service:

systemctl get-default
systemctl status display-manager --no-pager
loginctl list-sessions
journalctl -b -u display-manager --no-pager
Enter fullscreen mode Exit fullscreen mode

On Ubuntu, the concrete unit is commonly gdm3 for GNOME or sddm for KDE; RHEL-compatible systems commonly use gdm. If the service is disabled, enable the unit actually installed, for example sudo systemctl enable --now gdm3 or sudo systemctl enable --now sddm. Restarting display-manager can log out graphical users, so do not treat it as a harmless first troubleshooting step.

Older CentOS and Ubuntu examples (historical)

The original guide used the following commands on older systems. They are retained for readers maintaining legacy installations, not as current recommendations:

yum update && yum upgrade
yum -y groupinstall "KDE desktop" "X Window System" "Fonts"
yum groupinstall "GNOME Desktop" "Graphical Administration Tools"
apt-get update && apt-get upgrade
apt-get install ubuntu-gnome-desktop
Enter fullscreen mode Exit fullscreen mode

The ubuntu-gnome-desktop metapackage belongs to older Ubuntu GNOME releases; current Ubuntu's GNOME desktop is normally installed with ubuntu-desktop. The old removal command, apt-get remove ubuntu-gnome-desktop, removes the metapackage but does not necessarily remove every dependency it installed.

On SysV-era CentOS, the guide edited /etc/inittab, changed id:3:initdefault: to runlevel 5, and restarted with init 6. That is outdated on systemd systems. CentOS 7 also used this manual link to select graphical boot:

ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
Enter fullscreen mode Exit fullscreen mode

Prefer systemctl set-default graphical.target; do not edit /etc/inittab on current Ubuntu or RHEL-compatible releases.

Troubleshooting, security, and when to stay headless

If the screen stays black, switch to a text console (for example, Ctrl+Alt+F3), check df -h /, the display-manager status, and the boot journal before reinstalling packages. A failed graphics driver or a full root filesystem can look like a desktop problem. Also check which session and display manager were selected instead of repeatedly installing both desktops.

A display manager is a local login screen, not secure remote access. Do not expose X11, VNC, or RDP directly to the internet. Use key-based SSH, a firewall, and a VPN or carefully configured encrypted remote-desktop service, and keep the desktop packages patched. Avoid browsing or running everyday applications as root on a server.

For a production web, database, build, or application server administered over SSH, multi-user.target is usually preferable: fewer packages, lower idle resource use, fewer updates, and a smaller attack surface. Keep a desktop only when its graphical tools genuinely save time, and remove it only after checking dependencies and confirming that no user session or application relies on it.

Top comments (0)