How To Install Ubuntu Desktop On Ubuntu Server

How To Install Ubuntu Desktop On Ubuntu Server

Reading time1 min
#Linux#Ubuntu#Server#UbuntuDesktop#Sysadmin#RemoteDesktop

How To Install Ubuntu Desktop on Ubuntu Server

The need for a desktop environment sometimes emerges well after provisioning a headless Ubuntu Server—usually when GUI-driven tools, direct web browsing, or graphical IDEs become essential. Reinstallation is overkill; a precise package install is all that’s required.

Core problem: Retrofitting a GUI without disrupting existing workloads or redoing configuration.


System Requirements

  • Ubuntu Server 20.04 LTS or later (64-bit, as GNOME is not maintained for 32-bit).
  • Reliable broadband internet (installation size varies from ~1GB to 2.5GB depending on DE).
  • sudo or root privileges.
  • Direct console access or remote shell (SSH/VNC).
  • At least 2 CPU cores, 4GB RAM for GNOME Desktop. Lower-spec options available (see below).

1. Synchronize Package Repositories

Delayed package indices are a frequent source of dependency conflicts.

sudo apt update
sudo apt upgrade -y

Note: On production systems, consider unattended-upgrades for security patches.


2. Select a Desktop Environment

Full GNOME Desktop (ubuntu-desktop) is common, but pulls hundreds of ancillary packages.

Installation matrix:

EnvironmentCommandRAMDiskNotes
GNOME (default)sudo apt install ubuntu-desktop -y~2GB~2GBBrowser, suites
GNOME Minimalsudo apt install ubuntu-desktop-minimal~1.5GB~1.5GBFewer presets
XFCE (Xubuntu)sudo apt install xubuntu-desktop -y~1GB~1.3GBFast, lightweight
LXDE (Lubuntu)sudo apt install lubuntu-desktop -y~512MB~1GBFor low RAM

Trade-off: GNOME’s full stack gives you Snap, GDM, and office tools—but also eats disk/RAM. XFCE/LXDE are fast but less featured.

For GNOME Desktop (example):

sudo apt install ubuntu-desktop -y

3. Configure Default Boot Target

By default, Ubuntu Server uses multi-user.target (no GUI). Switch to graphical login:

sudo systemctl set-default graphical.target

This triggers GDM3 or relevant display manager on next boot.

Reboot:

sudo reboot

4. Headless Operation & Remote Desktop

No physical display? Direct login via SSH, but for GUI access—RDP is generally the least problematic.

Install xrdp:

sudo apt install xrdp -y
sudo systemctl enable xrdp --now
  • Default port: 3389.
  • Test with: mstsc.exe (Windows), remmina or rdesktop (Linux).

Known issue:
GNOME on xrdp can result in a black screen, due to Xorg authorization or .Xauthority permissions. If persistent:

  • Install XFCE as an alternative session:

    sudo apt install xfce4 xfce4-goodies -y
    echo "startxfce4" > ~/.xsession
    sudo systemctl restart xrdp
    
  • Adjust /etc/xrdp/startwm.sh if running multiple environments.

Practical note:
XRDP relays via Xorg on port 3389. If SSH tunnels are needed, use:

ssh -L 3389:localhost:3389 youruser@server

5. Verify GUI Environment / Launch Apps

Once logged in (physically or via RDP), open terminal or Activities and launch apps, e.g.:

firefox
gnome-terminal
nautilus

Check systemctl status gdm3 or lightdm if login greeter fails.

Example issue:

gdm[XXXX]: Failed to give slave programs access to the display. Try running as root.

Check user group membership (video, render), .Xauthority permissions, or try a different DE.


6. Reverting to Headless Mode

GUI environments are resource-intensive and can expose wider attack surfaces. To remove:

sudo apt remove ubuntu-desktop gdm3 gnome-shell -y
sudo apt autoremove --purge -y
sudo systemctl set-default multi-user.target
sudo reboot

Residual config and cache directories may remain in user home paths (~/.cache, ~/.local).


Summary Table

ActionCommand
Update & upgradesudo apt update && sudo apt upgrade -y
Install desktope.g. sudo apt install ubuntu-desktop -y
Set GUI defaultsudo systemctl set-default graphical.target
Rebootsudo reboot
Enable remote desktopsudo apt install xrdp -y

Additional Advice

  • For proprietary NVIDIA GPUs, install nvidia-driver-525 prior to desktop install. Kernel taints can inhibit GDM startup otherwise.
  • Snap-based apps (e.g., Chromium) require AppArmor profiles often missing from server installs—review logs in /var/log/syslog if apps fail silently.
  • System load increases with GUI components; monitor with htop or glances after install.
  • Some server workloads (KVM/QEMU virtualization, Docker) run unaffected by GUI presence, but always test after major environment changes.

For advanced or containerized workloads, consider lightweight remote management solutions (sshuttle, Cockpit, Webmin) in lieu of a full desktop.


Done: Server ↔ Desktop Conversion, No Data Loss

Since GUI installation is modular, this method preserves system data, SSH configurations, and running services. Still—the fewer changes to production servers, the better. For truly transient needs, using a disposable VM remains best practice.


If you encounter Failed to start GNOME Display Manager, always check /var/log/syslog and confirm systemd targets. Or sidestep GNOME’s quirks with XFCE in critical RDP workflows.