How to Install a Desktop Environment/GUI in Ubuntu Server
Most servers don’t need a graphical interface, but sometimes they can be a big help. Here’s how to install a desktop environment in Ubuntu Server.
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 a guide on how to set up a graphical user interface and install a desktop environment on your Ubuntu server.
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.
sudo apt update && apt upgrade
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:
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, issue the following command:
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.
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:
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
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 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 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. Here’s a curated list of the best Linux server distributions to get you started.
NOTE: If you like what we do, support our channel, put like and add our channel to your favorites. Follow Our Channel to get more guides.
Sponsor By: Meta Revolution World — Revold Project