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 NodeShift, which provides high-compute Virtual Machines at a very affordable cost on a scale that meets GDPR, SOC2, and ISO27001 requirements. It also offers an intuitive and user-friendly interface, making it easier for beginners to get started with Cloud deployments. However, feel free to use any cloud provider you choose and follow the same steps for the rest of the tutorial.
Step 1: Setting up a NodeShift Account
Visit app.nodeshift.com and create an account by filling in basic details, or continue signing up with your Google/GitHub account.
If you already have an account, login straight to your dashboard.
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.
3) Click on Start to start creating your very first compute node.
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%).
2) Next, select a geographical region from the Region dropdown where you want to launch your VM (e.g., United States).
3) Most importantly, select the correct specifications for your VM according to your workload requirements by sliding the bars for each option.
Step 4: Choose VM Configuration and Image
1) After selecting your required configuration options, you'll see the available VMs in your region and as per (or very close to) your configuration. In our case, we'll choose a '2vCPUs/2GB/60GB SSD' Compute node.
2) Next, you'll need to choose an image for your Virtual Machine. As per the topic of this tutorial, we'll select Ubuntu.
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.
2) Next, you'll need to select an authentication method. Two methods are available: Password and SSH Key. We recommend using SSH keys, as they are a more secure option. To create one, head over to our official documentation.
Step 6: Finalize Details and Create Deployment
Finally, you can also add a VPC (Virtual Private Cloud), which provides an isolated section to launch your cloud resources (Virtual machine, storage, etc.) in a secure, private environment. We're keeping this option as the default for now, but feel free to create a VPC according to your needs.
Also, you can deploy multiple nodes at once by clicking + in the Quantity option.
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.
Step 7: Connect to active Compute Node using SSH
As soon as you create the node, it will be deployed in a few seconds or a minute. Once deployed, you will see a status Running in green, meaning that our Compute node is ready to use!
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:
Step 8: Install GUI with Dependencies
1) Update the Ubuntu package source-list
apt update
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:
3) Install xfce4-session
xfce4-session
is a session manager for Xfce. It is responsible for saving and restoring the state of your desktop during each session.
apt install xfce4-session
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:
Once the installation is done, enable xrdp,
systemctl enable 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:
6) Add a new user
Let's add a user named "Jane" to log in to our desktop as a non-administrative client.
To create a user:
(replace username
with the username for the new user, e.g., jane)
adduser <username>
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:
2) Allow Inbound RDP
ufw allow 3389
Note: If you're using SSH to connect to your VM, you must allow SSH in the firewall before enabling the firewall to avoid losing access to the server.
ufw allow ssh
3) Enable Firewall
Now we may proceed to enable ufw to start the firewall in the system
ufw enable
Output:
Check firewall status,
ufw status
Output:
As you may notice, both ports have been allowed in the firewall.
Step 10: Access Ubuntu GUI
Open the 'Remote Desktop Connection' app (for Windows) or 'Windows App' (for MacOS) on your machine and put the IP address of your server on the Computer tab.
Once you click Connect, it will display some details as shown below, and take your consent. Click "yes" to proceed.
As soon as the remote connection is established with the server, it will open a login screen like this:
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.
Once logged in, you'll see a Welcome screen like this:
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:
Now, our Ubuntu GUI is successfully set up and ready to use!
Conclusion
In this article, we have covered the steps for setting up a Graphical User Interface (GUI) for the Ubuntu VM. Adding a GUI to your Ubuntu Server merges the power of command-line efficiency with the ease of a graphical interface, making server management accessible to all skill levels. This guide has walked you through the essentials of installing XFCE. Deploying Ubuntu GUI on NodeShift’s cloud infrastructure further enhances scalability and flexibility, enabling seamless integration into modern cloud-based environments. This combination ensures your application is well-optimized and ready to handle high traffic efficiently.
For more information about NodeShift:
Top comments (0)