Desktop environment on Ubuntu Server

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.

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 multiuser.target

Will switch back to command line interface.