How to Install Desktop on Ubuntu Server

One main difference between Ubuntu Server and Desktop is that Ubuntu Server Edition does not install a graphical user interface by default.

We don’t need a desktop to work with Ubuntu server, because the Linux command line interface is very powerful, more efficient and very easy to use. However, if you are new to the Linux operating system or quite unfamiliar with the command line interface, then Graphical user interface may become a handy tool for you.

If you really wish to install desktop on Ubuntu server, Several different types of desktops are available to you, including Xfce, Gnome, KDE, LXDE and Mate.

Install Xfce Desktop on Ubuntu Server

Xfce is a Fully featured lightweight desktop environment that requires less memory and processing power, therefore I will recommend to use Xfce as the graphical user interface for your Ubuntu server 18.04/16.04.

To install Xfce desktop on Ubuntu server, Run the following commands:

apt-get update
apt-get install lightdm xfce4

After the installation is finished, Create a new file named lightdm.conf in /etc/lightdm directory:

sudo nano /etc/lightdm/lightdm.conf

Add following lines to the lightdm.conf file:

[SeatDefaults]
allow-guest=false
user-session=xfce

Save the file and restart the server:

systemctl reboot

When the server reboot, The Ubuntu system will start with Xfce the desktop interface.

Install Xfce Desktop on Ubuntu Server

Default Run Level, Switch between Graphical Interface and Command line mode

When we install desktop on Ubuntu, the default runlevel will set to "graphical.target", That is why the server will start with a GUI.

To check default runlevel, Type:

sudo systemctl get-default

If you don’t want to use the Graphical User Interface, Then set the default target to multi-user.target and restart the Ubuntu server:

systemctl set-default multi-user.target
systemctl reboot

The system will go back to command line mode.

It is also possible to switch between command line mode and graphical mode with systemctl command.

systemctl isolate graphical.target

Will bring the graphical desktop instantly.

systemctl isolate graphical.target

Will switch back to command line interface.

Install LXDE Desktop on Ubuntu

LXDE is another extremely lightweight desktop environment that uses less memory and processing power, Even faster than Xfce desktop.

To install LXDE on Ubuntu server, Run the following command:

apt-get install xorg lightdm lxde lxde-core lxsession-logout network-manager

Add following lines to the /etc/lightdm/lightdm.conf file and restart the computer.

[SeatDefaults]
allow-guest=false
user-session=LXDE
Ubuntu Server with LXDE desktop

Install Gnome Desktop

Gnome is the most popular Linux desktop and the default desktop in most Linux distributions, Gnome is not fast as Xfce or LXDE, but provides more powerful and conventional desktop interface.

Installing Gnome desktop is very straightforward. First, Install the gnome-core package:

apt-get install gnome-core

Then, Restart the computer:

systemctl reboot

Install Mate Desktop on Ubuntu

Mate is another popular Linux desktop environment You can use on your Ubuntu server 18.04. To install mate on Ubuntu, Run the following command.

apt-get install lightdm mate-desktop-environment

And make sure that /etc/lightdm/lightdm.conf file is similar to bellow config:

[SeatDefaults]
allow-guest=false
user-session=mate
Mate Desktop on Ubuntu Server

Network Manager and Network Script

The systemd-networkd service manages network interfaces on Ubuntu server 18.04. But if you want to do network configurations via GUI, then you need to enable Network Manager.

Ubuntu server 16.04 use /etc/network/interfaces for interface configurations. But the network manager on your desktop will not manage any interfaces configured in /etc/network/interfaces file.

If you want to manage network interfaces via Network manager, Remove the interface configuration from /etc/network/interfaces and restart the network manager with following command.

systemctl restart network-manager.service

Summary

As you can see there are several desktop environment available for Ubuntu server, if you want to use a one. I would recommend to use Xfce, Mate or LXDE because there are faster and use less system resources.