Want to install a graphical user interface (GUI) on your Ubuntu server? Follow this guide to set up a GUI and enable remote access via RDP. Whether you're using a minimal install or a headless server, this tutorial will help you get started.
Before installing a GUI, update and upgrade your packages to the latest versions:
sudo apt update
sudo apt upgrade -y
Ubuntu supports multiple desktop environments. Choose one based on your needs:
 	- GNOME: Default Ubuntu Desktop, modern and clean.

 
 	- KDE Plasma: A customizable and visually appealing interface.

 
 	- Xfce: Lightweight, ideal for low-resource systems (used in Xubuntu).

 
 	- LXQt: Fast and lightweight (used in Lubuntu).

 
 	- MATE: A continuation of GNOME 2, designed for traditional desktops.

 
Install your chosen desktop environment with the appropriate command:
GNOME
sudo apt install ubuntu-desktop -y
KDE Plasma
sudo apt install kde-plasma-desktop -y
Xfce
sudo apt install xubuntu-desktop -y
LXQt
sudo apt install lubuntu-desktop -y
MATE
sudo apt install ubuntu-mate-desktop -y
 	- To enable remote desktop connections, install xRDP:
sudo apt install xrdp -y
 
 	- Allow RDP traffic through the firewall:
sudo ufw allow 3389
 
Reboot your system to apply the changes:
sudo reboot
After the reboot, use an RDP client to connect to your Ubuntu server:
 	- Windows: Open Remote Desktop Connection.
 
 	- Linux/macOS: Use an RDP client like Remmina or FreeRDP.
 
Enter the IP address and log in with your Ubuntu username and password.

To remove a desktop environment, use:
sudo apt purge <package-name>
Replace 
<package-name> with the desktop environment's package, e.g., 
ubuntu-desktop.
sudo apt update 
sudo apt upgrade -y
sudo apt install ubuntu-desktop -y
sudo apt install xrdp -y
sudo reboot