Skip to content

LinuxGuide

How to Install a GUI on Ubuntu Server

  • Updated
  • 12 min read
  • VPS Lane Engineering
Short answer

Ubuntu Server has no GUI. Install Xfce with sudo apt install --no-install-recommends xfce4 xfce4-terminal dbus-x11, then add xrdp.

How we tested this

Ubuntu 24.04.5 LTS (amd64) with Xfce 4.18, LXQt 1.4.0, MATE 1.26.1, xrdp 0.9.24, xorgxrdp 0.9.19, FreeRDP 2.11.5, ufw 0.36.2 and smem 1.5. Tested: APT install and removal, idle memory under Xvfb and under xrdp, and a full RDP login to Xfce from FreeRDP with real PAM password checks, one correct and one wrong, in an isolated network namespace. Not tested: GNOME, Ubuntu 22.04 and 26.04, and IPv6.

Ubuntu Server GUI Options Compared

The Ubuntu Server GUI options below differ far more in download and disk size than in idle memory, which is what our measurements showed.

Installing a GUI and reaching it remotely are two separate jobs. A desktop such as Xfce draws the screen, and xrdp is the RDP service that lets you see it from another computer. You need both on a VPS, and only the desktop if you sit in front of the machine.

This guide was tested on Ubuntu Server 24.04 LTS on amd64. The same packages exist on 22.04 and 26.04, but versions, dependencies and session behaviour can differ, so check the package names there before you follow these steps. You need a user with sudo, SSH access and, on a remote server, a way back in such as your provider console.

Measured on Ubuntu 24.04.5 with --no-install-recommends against a stock server package set
Desktop and packagesNew packagesDownloadDisk usedIdle memory (PSS)
Xfce: xfce4 xfce4-terminal dbus-x1113834.6 MB153 MB217.7 to 225.4 MB
LXQt: lxqt-core qterminal dbus-x11234108 MB410 MB209.9 to 210.4 MB
MATE: mate-core mate-terminal dbus-x11253155 MB688 MB215.1 to 216.9 MB
GNOME: ubuntu-desktop-minimal503301 MB1,018 MBnot measured
xrdp and xorgxrdp with their dependencies5146.7 MB206 MBsee the memory section

The light rows are core desktops, not the full Xubuntu, Lubuntu or Ubuntu MATE editions, and the GNOME row is the minimal Ubuntu desktop set. Package counts and sizes are what APT chose from the Ubuntu 24.04 archive on 26 November 2026, so they shift a little as updates land.

Xfce is our pick for most small servers. It had the smallest footprint on disk, it ran over xrdp in our login test and its memory use sat close to the others. LXQt suits you if you prefer Qt programs, and MATE has the most traditional layout. GNOME costs several times more disk and was not tested here.

Memory figures cover the desktop plus its X server, idle after sign in. A browser or office program adds much more, so size the server for the programs you will open. How we measured is in the memory section below.

Do You Need a GUI on Ubuntu Server

A GUI on Ubuntu Server makes sense when you need graphical programs, such as a browser or a desktop app with no web version.

It is not needed for normal server work. SSH covers packages, services and files, and web control panels run in your own browser without any desktop on the server. Every desktop also adds packages to keep updated and uses memory and disk, which the Ubuntu community documentation gives as the reasons servers ship without one.

Pick the lightest tool that does the job
You want toUse
Manage packages, services and filesSSH in a terminal
Click through server settingsA web based admin panel reached from your own browser
Run one graphical program now and thenX11 forwarding with ssh -X, which needs an X server on your own computer, such as XQuartz on a Mac
Work in a full desktop all dayA light desktop plus xrdp, as in this guide

Before You Install a Desktop on Ubuntu Server

Before you install a desktop on Ubuntu Server, take a snapshot and check that you have free memory and disk for it.

A provider snapshot is the most reliable rollback. Removal is covered at the end of this guide, but a snapshot puts the server back exactly as it was, including any package you did not mean to change.

bash
free -h
df -h /

Compare the available column of free and the Avail column of df with the table above. If disk is tight, see how to check disk space usage on Linux first. Then bring the system up to date so the desktop is not installed on top of old libraries.

bash
sudo apt update
sudo apt upgrade

Reboot afterwards if the upgrade asked for it. Ubuntu shows a restart notice in the SSH welcome text and creates /var/run/reboot-required when one is needed.

Install Xfce on Ubuntu Server

To install Xfce on Ubuntu Server, add the core packages with --no-install-recommends so APT installs only what they require.

The flag tells APT to skip packages that are merely recommended. Required dependencies are still installed. Preview the change first, because --assume-no prints the plan and sizes and then stops without changing anything.

bash
sudo apt-get install --assume-no --no-install-recommends xfce4 xfce4-terminal dbus-x11

This is the summary we got when we ran the command against a package list matching a stock Ubuntu Server 24.04 install. On your server the numbers depend on what is already installed.

Output
0 upgraded, 138 newly installed, 0 to remove and 1 not upgraded.
Need to get 34.6 MB of archives.
After this operation, 153 MB of additional disk space will be used.

Install it for real when the numbers look right.

bash
sudo apt-get install -y --no-install-recommends xfce4 xfce4-terminal dbus-x11

xfce4-terminal gives you a terminal inside the desktop and dbus-x11 provides dbus-launch for the session. This is the Xfce desktop, not the whole Xubuntu edition, so add other programs by name when you need them. In the same test xfce4 on its own needed 134 new packages with the flag and 664, with a 327 MB download, without it.

Install LXQt or MATE Instead

LXQt or MATE install the same way, each with its own core package and terminal.

bash
sudo apt-get install -y --no-install-recommends lxqt-core qterminal dbus-x11
sudo apt-get install -y --no-install-recommends mate-core mate-terminal dbus-x11

Pick one desktop. Two can live side by side, but that doubles the packages to update and makes a clean removal harder, as our own test showed.

Install the GNOME Desktop

The GNOME desktop comes from ubuntu-desktop-minimal, while ubuntu-desktop adds the fuller set of Ubuntu desktop apps.

Both are much heavier than the light desktops in the table. GNOME uses Wayland by default on a local Ubuntu desktop, while xrdp uses Xorg sessions. We did not test GNOME over xrdp, so this guide uses Xfce.

Skip the Display Manager on a Headless Server

A display manager is the graphical login screen, and on a headless server reached through xrdp you can usually skip it.

xrdp shows its own login and starts the desktop for you, so LightDM or GDM would only add a login screen on a monitor nobody looks at. If you use the server with a real monitor and keyboard, install one such as LightDM for that local login. Check how the server boots.

bash
systemctl get-default

multi-user.target means the server boots to text mode, the normal state for a server. If a package set it to graphical.target and you do not want a local login screen, set it back. This changes the next boot only. It does not stop a running session or remove a display manager.

bash
sudo systemctl set-default multi-user.target

Set Up xrdp Remote Desktop on Ubuntu Server

To set up xrdp remote desktop on Ubuntu Server, install xrdp with xorgxrdp, choose the session and make sure the service runs.

This guide uses xrdp because Windows, macOS and Linux all have standard RDP clients. VNC is the other common choice, mostly when you want to share a session that is already on screen, and our RDP vs VNC comparison covers the difference.

bash
sudo apt-get install -y --no-install-recommends xrdp xorgxrdp
sudo systemctl enable --now xrdp
systemctl status xrdp xrdp-sesman --no-pager

xorgxrdp is the Xorg module xrdp uses to run a real desktop session. active (running) for both services means they started. It does not prove a login works, which the steps below check.

Let xrdp Read Its TLS Key

xrdp must read its TLS key, and on Ubuntu 24.04 the service runs as the xrdp user while the key belongs to the ssl-cert group.

bash
id xrdp
ls -l /etc/ssl/private/ssl-cert-snakeoil.key
Output
uid=105(xrdp) gid=106(xrdp) groups=106(xrdp)
-rw-r----- 1 root ssl-cert 1704 Nov 26 09:15 /etc/ssl/private/ssl-cert-snakeoil.key

That real output from our 24.04 machine shows xrdp outside the ssl-cert group. If yours shows the same, add it and restart the service.

bash
sudo adduser xrdp ssl-cert
sudo systemctl restart xrdp

When the connection uses TLS, the default self signed certificate can trigger a trust warning in your RDP client. Do not accept that warning blindly. Read the fingerprint on the server over SSH and compare it with the one the client shows.

bash
sudo openssl x509 -in /etc/xrdp/cert.pem -noout -fingerprint -sha256

For long term use, a certificate from a trusted authority set in certificate and key_file in /etc/xrdp/xrdp.ini removes the warning.

Tell xrdp Which Desktop to Start

xrdp starts the desktop through /etc/X11/Xsession, which runs the .xsession file in your home folder if it exists.

bash
echo xfce4-session > ~/.xsession

Run it as the user who will sign in, not with sudo. Use startlxqt for LXQt or mate-session for MATE instead. Each user who connects needs their own file, or gets the system default session.

Check That xrdp Is Listening

Check that xrdp is listening with ss, filtered to the exact port so nothing else can match.

bash
sudo ss -ltnp 'sport = :3389'
Output
State  Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0      2            0.0.0.0:3389      0.0.0.0:*    users:(("xrdp",pid=19003,fd=10))

A LISTEN line proves the service is up on TCP 3389, the default xrdp port. It does not prove the firewall lets you in or that a desktop starts, so finish with a real connection.

Our test machine had no IPv6, so this shows IPv4 only and our IPv6 behaviour is untested. If you connect over IPv6, check that ss also shows an IPv6 address, and see the port= examples in /etc/xrdp/xrdp.ini for tcp6 listeners.

Secure the xrdp Port Before You Connect

Secure the xrdp port before you connect, because an open 3389 on a public address draws password guessing from scanners.

With the default security_layer=negotiate in /etc/xrdp/xrdp.ini, xrdp agrees a security layer with the client and normally uses TLS when that succeeds. That protects the session traffic, but it does not stop someone guessing a weak password, so keep the port off the internet where you can. The addresses in this guide, 203.0.113.10 for the server and 203.0.113.25 for your connection, are documentation examples. Replace them with your own.

Use an SSH Tunnel First

An SSH tunnel is the safer default, because xrdp then answers only on the server itself and you reach it through SSH.

Set the listener to the loopback address in /etc/xrdp/xrdp.ini, then restart xrdp and check the listener.

bash
port=tcp://.:3389
bash
sudo systemctl restart xrdp
sudo ss -ltn 'sport = :3389'
Output
LISTEN 0      2          127.0.0.1:3389      0.0.0.0:*

That is our real ss result after the change. The listener answers only on 127.0.0.1. From your own computer, open the tunnel and point the RDP client at the local end.

bash
ssh -N -L 127.0.0.1:33389:127.0.0.1:3389 user@203.0.113.10

Keep that SSH window open and connect your RDP client to 127.0.0.1:33389. Using 127.0.0.1 on both ends avoids localhost resolving to IPv6, and -N opens the tunnel without a remote shell. Do not open 3389 in any firewall in this setup. If SSH is not set up yet, start with how to enable SSH on Ubuntu.

Or Allow RDP From One Address

If you must connect directly, a ufw rule can allow RDP from one address only. --dry-run shows the rule without applying it.

bash
sudo ufw --dry-run allow proto tcp from 203.0.113.25 to any port 3389
Output
### tuple ### allow tcp 3389 0.0.0.0/0 any 203.0.113.25 in
-A ufw-user-input -p tcp --dport 3389 -s 203.0.113.25 -j ACCEPT

Run it again without --dry-run to apply it, then confirm with sudo ufw status numbered. Allow SSH before you run sudo ufw enable, or you can lock yourself out. In our tested setup xrdp 0.9.24 listened on TCP with no UDP socket, so the rule covers TCP only. A firewall at your provider needs the same limit.

Connect to the Ubuntu Server Desktop

To connect to the Ubuntu Server desktop, open an RDP client, enter the address and sign in with your Linux username and password.

xrdp checks the Linux account password. Signing in to SSH with a key does not give the account a password, so if you only ever used keys, set one first with sudo passwd youruser.

Connecting from common clients
ClientWhat to enter
Remote Desktop Connection on Windows203.0.113.10 in the Computer box, or 127.0.0.1:33389 with the tunnel
Windows App on Windows or macOSAdd a PC and enter 127.0.0.1:33389 while the tunnel runs, or 203.0.113.10 with the firewall rule
FreeRDP on Linuxxfreerdp /v:203.0.113.10 /u:youruser

With the SSH tunnel, every client connects to 127.0.0.1:33389 and the tunnel must be running. A direct address only works if you allowed your own IP with the firewall rule above. Mobile RDP apps can connect too, and their screens differ by app. For more Linux options, see our guide to the best Linux RDP client.

Xfce 4.18 desktop on Ubuntu Server 24.04 shown in a FreeRDP window after signing in through xrdp, with the panel at the top and the dock at the bottom
Our test session: Xfce 4.18 started by xrdp 0.9.24 on Ubuntu 24.04.5, viewed in FreeRDP.

That screenshot comes from a full login we ran with FreeRDP against xrdp, with the real Linux password check and the ~/.xsession file above. A wrong password in the same setup was refused and no session started. To check from your own computer that RDP answers through the SSH tunnel, scan the local end of the tunnel while it is open.

bash
nmap -Pn -sV -p 33389 127.0.0.1
Output
PORT      STATE SERVICE       VERSION
33389/tcp open  ms-wbt-server xrdp

That is our real result through a tunnel to the loopback only listener. If you allowed the port directly instead, scan the server address on 3389 from your own computer.

Light Desktop RAM Usage Measured

Light desktop RAM usage was measured by starting each desktop and adding up the PSS of every process in its session.

Each run used a fresh 1280 by 800 Xvfb screen with 24 bit colour and a test user with nothing else running. After 60 seconds idle we read the total with smem. PSS splits memory shared by several processes fairly between them, so it does not count shared libraries twice the way a sum of RSS does.

bash
smem -U guitest -t -k -c "name pss rss"
Idle session total PSS on Ubuntu 24.04.5, X server included
DesktopRun 1Run 2Run 3Of which X server
Xfce 4.18 under Xvfb225.4 MB217.7 MB218.1 MBabout 50 MB
LXQt 1.4.0 under Xvfbexcluded, session did not start fully210.4 MB209.9 MBabout 38 MB
MATE 1.26.1 under Xvfb215.1 MB216.9 MB216.8 MBabout 68 MB
Xfce 4.18 through xrdp219.8 MB224.3 MBnot run51.6 and 55.1 MB (Xorg)

All three sat within about 15 MB of each other at idle. The sum of RSS was more than twice as high, between 527 and 607 MB, which is why top or ps make a desktop look heavier than it is. The two xrdp sessions are a rough reference rather than a controlled benchmark. They used the real Xorg server with xorgxrdp and also ran file manager helpers left from earlier tests, yet still landed close to the Xvfb figures.

These numbers leave out the rest of the server, its own services and any program you open. Ubuntu lists 1 GB as the minimum RAM for 24.04 cloud images and suggests 3 GB or more. Our own view, not a published minimum, is 2 GB for a light single user desktop and 4 GB if a browser runs beside other work.

If you want that room, an Ubuntu VPS plan with 2 GB or more and full root access lets you install the desktop exactly as shown here.

How to Remove the GUI From Ubuntu Server

To remove the GUI from Ubuntu Server, mark the desktop packages as automatic, simulate apt autoremove --purge and read the list first.

Restoring a snapshot is still the most reliable undo. APT tracks which packages were pulled in as dependencies, but marking the desktop as automatic does not promise that every piece goes, as the test below shows. Check first that the server boots to text mode with systemctl get-default.

bash
sudo apt-mark auto xfce4 xfce4-terminal dbus-x11 xrdp xorgxrdp
sudo apt-get autoremove --purge --simulate

Read every package on the list. If it names something you still use, mark it with sudo apt-mark manual and simulate again. Then run it for real.

bash
sudo apt-get autoremove --purge

This is the real summary from our test machine after removing Xfce. The numbers are lower than in the install table because some libraries were already there for other tests.

Output
0 upgraded, 0 newly installed, 34 to remove and 74 not upgraded.
After this operation, 30.7 MB disk space will be freed.

Confirm the desktop is gone with an exact package query. These messages mean none of those packages is installed any more.

bash
dpkg-query -W xfce4 xfce4-session xfwm4
Output
dpkg-query: no packages found matching xfce4
dpkg-query: no packages found matching xfce4-session
dpkg-query: no packages found matching xfwm4

A clean query does not prove every helper package went. APT keeps an automatic package while another installed package still recommends it. In our test xfce4-terminal and dbus-x11 stayed, because a package left from an earlier LXQt test recommended them. List what is left and remove it by name if you do not need it.

bash
apt list --installed 2>/dev/null | grep -E '^(xfce4|xrdp|xorgxrdp|dbus-x11)/'

Finally remove the pieces APT does not track. Delete ~/.xsession for each user, delete the ufw rule with sudo ufw status numbered and sudo ufw delete followed by its number, and remove the same rule from any provider firewall.

Ubuntu Server GUI Troubleshooting

Most Ubuntu Server GUI problems over xrdp come down to the session file, the password, the firewall or a second login.

Common xrdp desktop problems
What you seeLikely causeFix
Black screen or session closes after loginNo ~/.xsession or a wrong session commandWrite xfce4-session to ~/.xsession as that user
SSH works but RDP login failsThe account has no password, since SSH used a keySet one with sudo passwd youruser
Session closes at once for one user onlyThat user may already be signed in to a local desktopSign out of the local session first
Connection refusedxrdp is not running or listens on another portCheck systemctl status xrdp and the ss output
Timeout with no answerA firewall drops the packetsCheck ufw and the provider firewall for TCP 3389
xrdp fails to start with a key or certificate errorxrdp cannot read its TLS keyAdd xrdp to ssl-cert and restart
Desktop feels slowWindow compositing over a remote linkTurn off the compositor in Xfce Window Manager Tweaks

The logs are the next stop when the table does not help. These are the default locations on Ubuntu 24.04.

bash
sudo journalctl -u xrdp -u xrdp-sesman -n 50 --no-pager
sudo tail -n 50 /var/log/xrdp.log /var/log/xrdp-sesman.log

A refused password shows up clearly in the session manager log. These are the real lines from our wrong password test.

Output
[ERROR] pam_authenticate failed: Authentication failure
[INFO ] AUTHFAIL: user=guitest ip=127.0.0.1 time=1795730607

For errors from the desktop itself, look in the user home at ~/.xsession-errors and at ~/.xorgxrdp.10.log, where the number matches the session display. Our test session wrote .xorgxrdp.10.log.

Questions people ask

Does Ubuntu Server come with a GUI?

No. Ubuntu Server installs without a desktop. You add one with APT, and it stays the same server install with a desktop on top.

Which GUI is best for Ubuntu Server?

Xfce for most servers. It had the smallest download and disk use in our test and ran over xrdp, while idle memory was similar for all three.

Can I run a GUI on a 1 GB Ubuntu VPS?

An idle light desktop used about 210 to 225 MB in our test, so it fits, but a browser on top quickly fills 1 GB. We would start at 2 GB.

Can I install a GUI on Ubuntu Server without a display manager?

Yes. With xrdp you do not need LightDM or GDM, because xrdp shows its own login and starts the desktop session itself.

How do I access the Ubuntu Server GUI remotely?

Install xrdp and xorgxrdp, set your session in ~/.xsession, then connect with an RDP client, ideally through an SSH tunnel.

Do I need to reboot after installing Xfce and xrdp?

Usually not. Once xrdp runs and ~/.xsession is set you can connect. Reboot only if an update asks for it.

How do I uninstall the GUI from Ubuntu Server?

Mark the desktop packages as automatic with apt-mark auto, simulate apt autoremove --purge, check the list, then run it.

Sources

  1. Ubuntu Server documentation, System requirements
  2. xrdp project README on GitHub
  3. xrdp.ini manual page for Ubuntu 24.04
  4. apt-get manual page for Ubuntu 24.04
  5. smem manual page for Ubuntu 24.04
  6. Ubuntu Server documentation, Firewalls
  7. Ubuntu community help, Server GUI

Written and tested by VPS Lane EngineeringWe run every step on real servers before publishing and update the guide when the software changes.