How to Install a Desktop (GUI) on an Ubuntu Server
Add a desktop to Ubuntu Server: choose between GNOME, Xfce, LXQt and KDE, install it, reach it over Remote Desktop with xrdp, and remove it again.
2 min readBy Daniel
Reviewed by the AmazingRDP technical team

A desktop needs memory. See Linux VPS plans with 4 GB or more. See Linux VPS from $6.99
Ubuntu Server has no graphical desktop: it saves memory, and most server work is done over SSH. Sometimes you still need one, for a program with windows, a browser on the server, or because you are more at home with a mouse. Adding a desktop is one command. Reaching it on a server without a screen takes one more step, covered below.
Choose a desktop
| Desktop | Install command | Memory to plan for | Character |
|---|---|---|---|
| Xfce | sudo apt install xfce4 xfce4-goodies | 2 GB | Light and quick; the usual choice on a server |
| LXQt | sudo apt install lxqt | 2 GB | Lightest of the four |
| GNOME (Ubuntu's own) | sudo apt install ubuntu-desktop-minimal | 4 GB | The standard Ubuntu look |
| KDE Plasma | sudo apt install kde-plasma-desktop | 4 GB | Most features and settings |
On a VPS, choose Xfce unless you have a reason not to. It works best over a remote connection.
1. Update, then install
sudo apt update && sudo apt upgrade -y
sudo apt install xfce4 xfce4-goodies
The download is several hundred megabytes. If you are asked to choose a display manager, pick lightdm for Xfce or LXQt and gdm3 for GNOME.
2. Reach the desktop
A machine with its own screen: restart it, and the login screen appears.
sudo reboot
A VPS or remote server: there is no screen, so install xrdp. It lets you connect with the same Remote Desktop program you use for Windows.
sudo apt install xrdp
sudo adduser xrdp ssl-cert
echo "startxfce4" > ~/.xsession
sudo systemctl restart xrdp
The third line tells xrdp to start Xfce for your user. Now open Remote Desktop Connection on your PC, enter the server's address, and sign in with your Linux user name and password. See how to connect to RDP from a desktop.
Remote Desktop uses port 3389. Do not open it to the whole internet. Either allow only your own address:
sudo ufw allow from 203.0.113.10 to any port 3389 proto tcp
or keep the port closed and connect through an SSH tunnel: run ssh -L 3390:127.0.0.1:3389 user@SERVER_IP on your PC and connect Remote Desktop to 127.0.0.1:3390.
3. Do not sign in as root
Use a normal user for the desktop and sudo when needed. If your server only has root, create a user first:
sudo adduser alex
sudo usermod -aG sudo alex
Problems and fixes
- A black screen after signing in with xrdp. The
~/.xsessionfile is missing for that user, or the same user is already signed in on another session. Sign out there. - The server is slow after installing. A desktop uses 500 MB to 1.5 GB by itself. Check with
free -h. - The desktop starts at boot although you rarely use it. Go back to text start-up with
sudo systemctl set-default multi-user.target; xrdp still works.
Remove the desktop again
sudo apt purge xfce4 xfce4-goodies xrdp
sudo apt autoremove --purge
sudo systemctl set-default multi-user.target
Do you need a desktop?
For administration, no: SSH is lighter and safer. For editing files from your PC, see Notepad++ and Ubuntu Server. If what you really want is a remote Windows desktop, that is what our RDP plans are. For Linux with a desktop, pick a Linux VPS with enough memory. Related: install a VNC server on CentOS.
Questions
Which desktop is best for an Ubuntu server?
Xfce. It is light and works well over a remote connection.
How do I connect to the desktop on a VPS?
Install xrdp and connect with a Remote Desktop program, or use VNC.
How much memory does a desktop need?
Plan for 2 GB with Xfce or LXQt and 4 GB with GNOME or KDE.
Can I remove the desktop later?
Yes. Purge the desktop packages and run sudo apt autoremove --purge.