When you think of Ubuntu Server, the picture of a command-line interface might be the first thing that comes to mind. While the terminal is powerful and lightweight for developers who want speed, there are situations where a Graphical User Interface (GUI) can make life easier, especially for users new to Linux or those who prefer visual navigation. If you want to manage server tasks more intuitively or run applications requiring a desktop environment, you can install a GUI environment for your server. Also, you can switch between CLI and GUI at any time, according to your needs and preferences.
In this guide, we’ll walk you through the steps to install a GUI on your Ubuntu Server, ensuring you can seamlessly switch from the command line to a full desktop experience. We'll go from choosing the right environment for our requirements to configuring the GUI and connecting to the desktop remotely using Remote Desktop Protocol (RDP).
Prerequisites
A Virtual Machine (such as the ones provided by NodeShift) with at least:
- 2 vCPUs
- 2 GB RAM
- 25 GB SSD
Ubuntu 22.04 VM
Note: The prerequisites for this are highly variable across use cases. For a large-scale deployment, one could use a high-end configuration.
Step-by-step process to install GUI on Ubuntu 22.04
For this tutorial, we'll use a CPU-powered Virtual Machine by and create an account by filling in basic details, or continue signing up with your Google/GitHub account.
If you already have an account,
Step 2: Create a Compute Node (CPU Virtual Machine)
After accessing your account, you should see a dashboard (see image), now:
1) Navigate to the menu on the left side.
2) Click on the Compute Nodes option.
These Compute nodes are CPU-powered virtual machines by NodeShift. These nodes are highly customizable and let you control different environmental configurations, such as vCPUs, RAM, and storage, according to your needs.
Step 3: Select configuration for VM
1) The first option you see is the Reliability dropdown. This option lets you choose the uptime guarantee level you seek for your VM (e.g., 99.9%).
3) Most importantly, select the correct specifications for your VM according to your workload requirements by sliding the bars for each option.
Step 5: Choose the Billing cycle and Authentication Method
1) Two billing cycle options are available: Hourly, ideal for short-term usage, offering pay-as-you-go flexibility, and Monthly for long-term projects with a consistent usage rate and potentially lower cost.
.
That's it! You are now ready to deploy the node. Finalize the configuration summary; if it looks good, go ahead and click Create to deploy the node.
Once your node shows this status, follow the below steps to connect to the running VM via SSH:
1) Open your terminal and run the below SSH command:
(replace root with your username and paste the IP of your VM in place of ip after copying it from the dashboard)
ssh root@ip
2) In some cases, your terminal may take your consent before connecting. Enter ‘yes’.
- A prompt will request a password. Type the server's password, and you should be connected.
Output:
2) Install Xfce desktop environment
For the Ubuntu GUI, we'll use Xfce, a light and efficient desktop environment. However, if you want a fully-fledged Ubuntu Desktop experience, you can also go for GNOME, which is a resource-intensive environment. The steps are almost similar irrespective of the type of environment.
Install Xfce with the following command:
DEBIAN_FRONTEND=noninteractive apt-get -y install xfce4
Output:
4) Install xrdp
XRDP (X Remote Desktop Protocol) is an open-source tool to connect to Linux-based systems using RDP (Remote Desktop Protocol)
apt-get -y install xrdp
Output:
5) Enable SSL certificate for the user
A SSL certificate is needed for XRDP because it establishes an encrypted link between a server and a client. To use an SSL certificate with XRDP, the certificate must be readable to the user. Use the following command to do that:
adduser xrdp ssl-cert
Output:
Step 9: Enable Firewall
To allow inbound RDP requests to the server, we'll need to allow 3389, the port for remote connections.
1) Install UFW (Ubuntu Firewall Management)
apt install ufw
Output:
Check firewall status,
ufw status
Output:
Once you click Connect, it will display some details as shown below, and take your consent. Click "yes" to proceed.
Log in using the password of the user of your VM that you created in one of the previous steps.
For example, we are logging in using the credentials of the user "Jane". Click "Ok" to log in.
Click on Start Setup, which will prompt you to quickly set up some basic settings on the desktop. Once done, you'll be able to see the official Ubuntu Desktop home screen like the below image:
SOCIAL SHARE CARD GENERATOR