Why Would You Need a GUI?
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 server machine as long as the performance isn’t massively bottlenecked.
Using a GUI helps a lot when dealing with video or audio streaming since you get an easy-to-comprehend visual understanding of the on-screen elements.
Step 1: Update and Upgrade Your System
This is a fundamental step before making any changes or installing packages into your Ubuntu server. Update Ubuntu’s software repositories and upgrade your system with the APT package manager.
Finalize the updates and upgrades, then move on to the next step.
Step 2: Install the Desktop Environment
There are a variety of desktop environments to choose from, but if your hardware can afford it, let’s proceed with the default Ubuntu GNOME desktop environment. You are always free to choose from other alternatives, but this freedom comes at the risk of some software incompatibility.
To install the GNOME desktop on your Ubuntu server, use the APT package manager to download and install the package:
To install the KDE Plasma desktop on your Ubuntu server, use the APT package manager to download and install the package:
To install MATE on your Ubuntu server, issue the following command:
To install the XFCE desktop, run:
Unsure which desktop environment to choose? Get started with this list of the best Linux desktop environments.
Step 3: Install and Set Up a Display Manager
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 a server system, 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
To install LightDM on your server, use the APT package manager:
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
Setting Up LightDM
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:
Run this command to start the LightDM service using the service utility:
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 desktop environment 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:
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. Here’s a curated list of the best Linux server distributions to get you started.