If you’ve just installed Ubuntu Server for the first time, you might want a familiar user interface, perhaps similar to Ubuntu Desktop. Here is a guide to setting up a graphical user interface and installing a desktop environment on your Ubuntu server.
Why do you need a GUI?
In general, server computers do not 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 not to install GUI on production servers to better manage resources and ensure maximum performance.
However, if you only installed Ubuntu Server for personal use, perhaps on a spare laptop to stream media, it’s perfectly fine to install a GUI on your server machine as long as performance isn’t severely impacted.
Using a GUI is very helpful when dealing with video or audio streaming, as it gives you an easy-to-understand visual understanding of the elements on the screen.
Step 1: Update and update your system
This is a fundamental step before making any changes or installing packages on your Ubuntu server. Update Ubuntu’s software repositories and update your system using the APT package manager.
sudo apt update && apt upgrade
Complete the updates and upgrades, and then continue 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, we’ll continue with the default Ubuntu GNOME desktop environment. You are always free to choose from other alternatives, but this freedom comes with 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:
sudo apt install ubuntu-desktop
To install the KDE Plasma desktop on your Ubuntu server, use the APT package manager to download and install the package:
sudo apt install kde-plasma-desktop
To install MATE on your Ubuntu server, enter the following command:
sudo apt install ubuntu-mate-core
To install the XFCE desktop, run:
sudo apt install xubuntu-core
Not sure which desktop environment to choose? Start with this list of the best Linux desktop environments.
Step 3: Install and set up a display manager
After installing the desktop environment, you must install a display manager to manage users and load the desktop environment sessions.
Since you are working with a server system, it is best to opt for lightweight solutions that conserve resources. If so, consider installing and using LightDM, a fast, lightweight, cross-desktop display manager.
To install LightDM on your server, use the APT package manager:
sudo apt install lightdm
During the installation process, you will be asked to choose between GDM3 (GNOME’s default display manager) and LightDM.
Select LightDM with spacebar and mark
Set up LightDM
After the installation process is complete, you need to enable the LightDM service. You can use either the service command or the systemctl command to do this.
Run this command to start the LightDM service using systemctl :
sudo systemctl start lightdm.service
Run this command to start the LightDM service using the utility:
sudo service ligthdm 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 desktop environment session after successfully logging in.
In case you want to try alternatives to LightDM, here is a guide on how to uninstall and remove LightDM.
How to remove GUI from Ubuntu Server
It only takes a few commands and a system reboot to return to the CLI experience. Using the APT package manager, remove any 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 have a different desktop environment installed.
Reboot your system and the changes should take effect.
Best Linux server distributions to choose from
Ubuntu Server is arguably the most popular server distribution today. In the open source world, however, there are always alternatives to choose from. If the Ubuntu experience is becoming obsolete for you, consider migrating to an alternative server OS. Here’s a curated list of the best Linux server distros to get you started.
The 10 Best Linux Server Distributions
About the author