How to install the GUI on the Ubuntu server [Beginner’s Guide]


Do you want to install the GUI on your Ubuntu server? You can totally do this in most scenarios and I will discuss the steps in detail in this tutorial.

But before I see that, let me tell you why the server edition does not come with the GUI and in which cases you can install the GUI on your server.

Why does the Ubuntu server not have a GUI?

If you compare the Ubuntu desktop with the server, the main difference will be the lack of a GUI, i.e. the desktop environment in the server edition. Ubuntu Server is essentially a simplified version of the Ubuntu desktop without the graphics modules.

It is intentional. A Linux server intends to use system resources on running services. The graphical desktop environment consumes a lot of system resources and for this reason, server operating systems do not include a desktop environment by default.

You can run an Ubuntu server on 512MB of RAM, but an Ubuntu desktop will need at least 2GB of RAM to function properly. It is considered a waste of resources in the server world.

As a server user (or system administrator), you must use and manage your system through the command line. You must have a good knowledge of Linux commands for this purpose.

Typically, you should manage a server from the command line

Do you really need to install a GUI on your server?

Some people are uncomfortable with the idea of ​​doing everything using the terminal commands. Most people are conditioned to use a computer graphically after all.

You can choose to install a desktop environment on your server and use it graphically. This is not how most people do it, but it is an option.

But it only works if you have direct access to the server. If you run it on a physical machine like a server, desktop / laptop or devices like Raspberry Pi. You can also install it on a server running in a virtual machine if you have direct access to the host system.

If you have a server deployed using a cloud server provider like Linode, DigitalOcean or AWS, installing GUI will not be a good idea. If you have a remote server that you want to manage graphically, you can use tools like Webmin or Cockpit. These tools allow you to use and manage your servers graphically in a web browser. It consumes much less system resources than a full-fledged desktop environment.

Cockpit interface
Tools like Cockpit allow you to graphically manage Linux servers

How to install the GUI on the Ubuntu server?

Once the basics are clear, let’s see the steps to install a desktop environment on an Ubuntu server.

You will need the following:

  • Ubuntu server configured and running with at least 2 GB of RAM
  • Administrative privileges (you need to run sudo commands)
  • Internet connection (you will download and install new packages)

In my case, the Ubuntu server is installed in a virtual machine and I have direct access to the host machine. I used the same method on an Ubuntu server installed on a Raspberry Pi.

These things are suitable for experimental purposes as you learn and explore. Please do not add GUI on a production server. Removing the GUI afterwards can cause dependency issues and leave a broken system in some cases.

Prepare your system

First, since you are going to be making system wide changes, let’s update and upgrade everything to make sure our system is running the latest packages:

sudo apt update && sudo apt upgrade

Installing the Desktop Environment

After the updates are removed, you can continue installing a desktop environment.

There are two ways to do this:

  • Use apt to install packages
  • Using a Debian tool called tasksel which helps to install multiple packages in a coordinated process (tasks)

Either will allow you to install the full desktop environment you choose as a full package, just like installing the desktop version from scratch. By that I mean you will get all the default apps and tools that you get with the desktop version.

If you want to use tasksel you need to install it first using the following command:

sudo apt install tasksel

Once this task is completed, you can use tasksel to install the desktop environment (also called DE).

By now you probably know that there are several desktop environments available. You can choose the one you like. Some desktop environments need more system resources (like GNOME) while others use less system resources (like Xfce, MATE, etc.).

It is up to you to decide which DE you want to use. I go with the GNOME Desktop since it is the default Ubuntu desktop. Later, I will also share some tips for setting up different desktops.

If you use tasksel run this command:

sudo tasksel install ubuntu-desktop

if you want to use only apt, run this command:

sudo apt install ubuntu-desktop

Depending on your connection speed and your hardware, this process will take anywhere from a few minutes to an hour.

I want to stress that both actions will result in the complete installation of the GNOME desktop environment. I ran both commands for the sake of this tutorial and ended up having the exact same results.

Installation and configuration of the display manager

After this process is complete, you will need a component called a display manager, also known as a “connection manager”. This tool will be responsible for starting the display server and loading the desktop while managing user sessions and authentication.

By default, GNOME Desktop uses GDM3 as its display manager, but it’s a bit heavy on the resource side. You can use something lighter and more resource-friendly. In this case, let’s go with lightdm, a platform independent display manager. Install it with apt:

sudo apt install lightdm

When installing lightdm, the system will ask for a default display manager as only one can run at a time, although you can install more than one.

Installing the display manager on the Ubuntu server
Use the arrow key to select an option, then use the Tab key to select and press enter

Just choose lightdm in the list and press . It shouldn’t take more than a few minutes. Once this task is completed, you can start the display manager and load the GUI with the following command:

sudo service lightdm start

If you want to check which display manager is configured in your system, you can run:

cat /etc/X11/default-display-manager

and you will get a prompt similar to this:

default installation of ubuntu gui server
Checking the Default Display Manager

If everything went as planned, you will have a loaded home screen.

gui installation ubuntu gnome server desktop greeting
GNOME Desktop Home Screen with LightDM on an Ubuntu Server

Enter your credentials and your desktop will be up and running.

installation of the gnome desktop of the ubuntu gui server
GNOME desktop fully loaded on the Ubutnu server

If you want to stop the GUI, open a terminal window and type:

sudo service lightdm stop

Installation of other desktop environments (optional)

Earlier I said we can choose different desktops, so let’s take a look at some alternatives.

BOYFRIEND

BOYFRIEND is a lightweight desktop based on the GNOME2 core code, it is fully open source and a very nice option.

To install MATE, you would run:

sudo tasksel install ubuntu-mate-core

or

sudo apt install ubuntu-mate-core

Lubuntu / LXDE / LXQT

Lubuntu is another lightweight option that I recommend if your system is running low on resources or you’re giving new life to an older computer. Install it using this command:

sudo tasksel install lubuntu-core

or

sudo apt install lubuntu-core

Xubuntu / Xfce

Xubuntu is a derivative of Ubuntu based on the Xfce light, simple, stable, but also highly customizable desktop environment. If you want to try it, use the following command:

sudo tasksel install xubuntu-core

or

sudo apt install xubuntu-core

I’m leaving a few other desktops, like KDE, Cinnamon, and Budgie, not for anything bad, they’re all great desktops too and you are free to install them however you like.

How to remove the GUI from the Ubuntu server?

If you find that the desktop environment is using too much computer resources, you can remove the packages that you installed earlier.

Please keep in mind that this can lead to dependency issues in some cases, so please take a backup of your important data or create a system snapshot.

You know how to remove packages from Ubuntu:

sudo apt remove ubuntu-desktop
sudo apt remove lightdm
sudo apt autoremove
sudo service lightdm stop

Restart your system now. You should be back to the normal command line connection.

Wrap

Installing a GUI for a desktop is possible but not necessary in most scenarios. If you are not too comfortable with the command line, use a server distribution like YunoHost which is built on Debian to give you a server that can be managed through GUI.

Having said that, if you are installing a system from scratch, I recommend that you use a desktop version and skip the extra steps afterwards.

With this information, I leave the comment section to you. Are you using the GUI on a server? Did you have any issues while taking this tutorial?


About Jon Moses

Check Also

Intel promises “substantial contributions” to the growth of RISC-V • The Register

Analysis Here’s something that would have seemed odd just a few years ago: to help …

Leave a Reply

Your email address will not be published.