If you've just installed Ubuntu Server for the first time, you may want a familiar user interface, perhaps similar to Ubuntu Desktop. Here's how to install and set up a graphical user interface (GUI)/desktop environment on your Ubuntu server.

Why Would You Need a GUI on Ubuntu Server?

Generally, server machines don't use a graphical user interface (GUI), and the command-line interface (CLI) is the preferred solution for day-to-day operations. It is even recommended that you refrain from installing GUI on production servers to better manage resources and ensure maximum performance.

However, if you have installed Ubuntu Server solely for personal use, maybe on a spare laptop to stream media, it's perfectly fine to install a GUI on your Ubuntu Server machine as long as the performance isn't massively bottlenecked.

Installing a GUI on your Ubuntu server helps a lot when dealing with video or audio streaming since you get an easy-to-comprehend visual understanding of the on-screen elements.

1. Update and Upgrade Your System

This is a fundamental step before making any changes or installing packages on your Ubuntu server. Update Ubuntu's software repositories and upgrade your system with the APT package manager.

        sudo apt update && apt upgrade
    

Finalize the updates and upgrades, then move on to the next step to install a GUI on Ubuntu Server.

2. Install a Desktop Environment as the GUI on Ubuntu Server

ubuntu desktop environment

There are a variety of desktop environments to choose from, but if your hardware can afford it, proceed with the GNOME desktop environment, the default desktop for Ubuntu systems. You are always free to choose from other alternatives, but this freedom comes at the risk of some software incompatibility.

To install GNOME as the GUI on your Ubuntu server, use the APT package manager to download and install the package:

        sudo apt install ubuntu-desktop
    

To install KDE Plasma as the GUI, use APT to download and install the package:

        sudo apt install kde-plasma-desktop
    

To install MATE on your Ubuntu server, issue:

        sudo apt install ubuntu-mate-core

To install the XFCE desktop, run:

        sudo apt install xubuntu-core
    

Unsure which desktop environment to choose? Get started with this list of the best Linux desktop environments.

Additionally, if you've installed multiple desktop environments on your Ubuntu server, you can switch between them from the display manager's login screen. Simply click on the name of the currently selected GUI and select your choice from the drop-down menu.

3. Install and Set Up a Display Manager on Ubuntu Server

login screen of display manager (3)

After installing the desktop environment, you need to install a display manager to manage users and load up the desktop environment sessions.

Since you are working with Ubuntu Server, it's best to opt for lightweight solutions that are easy on the resources. In this case, consider installing and using LightDM, a fast, lightweight, and cross-desktop display manager.

Installing LightDM on Ubuntu Server

select lightdm and hit ok

To install LightDM on your server, use the APT package manager:

        sudo apt install lightdm
    

During the installation process, you will be prompted to choose between GDM3 (the default display manager of GNOME) and LightDM.

Choose LightDM using Spacebar and highlight <OK> using the Tab key. Finalize your choice and set LightDM as the default display manager by pressing Enter.

Setting Up LightDM on Ubuntu Server

Now that the installation process is done, you need to enable the LightDM service. You can either use the service command or the systemctl command to do that.

Run this command to start the LightDM service with systemctl:

        sudo systemctl start lightdm.service
    

Run this command to start the LightDM service using the service utility:

        sudo service lightdm start
    

Reboot your system with the reboot command. The next time your system boots up, you should be greeted by the LightDM greeter and a GUI on your Ubuntu Server session upon successful login.

In case you want to try alternatives to LightDM, here's a guide on how to uninstall and remove LightDM.

How to Remove GUI From Ubuntu Server

It only takes a few commands and one system reboot to revert to the CLI experience. Using the APT package manager, remove all the previously installed packages:

        sudo apt autoremove ubuntu-desktop
sudo systemctl stop lightdm.service
sudo apt autoremove lightdm

Remember to change the desktop package name in the first command if you've installed some other desktop environment.

Reboot your system and the changes should be in effect.

Best Linux Server Distributions to Choose From

Ubuntu Server is arguably the most popular server distribution of today. However, there are always alternatives to choose from in the open-source world.

If the Ubuntu experience is turning stale for you, consider migrating to an alternative server operating system.