Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Hosted-services / Azure

Install a Desktop Environment GUI on Ubuntu Server in Azure

0.00/5 (No votes)
8 Aug 2020CPOL2 min read 14.5K  
Installing a desktop environment and setting up RDP to allow us to connect to our Virtual Machine
Here we look at: Installing the xfce desktop environment, installing and configuring Xrdp, and disabling the compositor

All the Linux server Virtual Machine images on Azure don’t come with a desktop environment, which is obviously usually the right thing to do with a server. There’s usually no need for a desktop environment as all operations can be done from the CLI via ssh. However, maybe you need a desktop environment for another reason. For example, setting up Azure Lab Services for class rooms, maybe those Virtual Machines need a desktop enviroment for lessons in your lab.

1. Install the xfce Desktop Environment

First, before we get started, let’s make sure that our VM is completely up to date by running apt-get update and apt-get upgrade.

Shell
sudo apt-get update 
sudo apt-get upgrade

Next let’s install xfce, xfce is a fairly lightweight but still very user friendly desktop environment. Of course, you can install Unity or KDE or whatever floats your boat, but to keep resources free for other operations, I’ve chosen to use a lightweight desktop environment.

The –no-install-recommends flag tells apt-get to not consider recommended packages to install, this ensures we only get the minimal packages neeeded to get xfce running.

Shell
sudo apt-get install -y xfce4 --no-install-recommends

2. Install and Configure Xrdp

Xrdp is an open source package that allows us to login to remote Virtual Machines using RDP (Microsoft Remote Desktop Protocol).

You can view the project on github.

Install Xrdp with apt-get

Shell
sudo apt-get install -y xrdp

Once it’s installed, Xrdp should start automatically, check that it is running by typing:

Shell
sudo systemctl status xrdp

Configure Xrdp

Xrdp uses the /etc/ssl/private/ssl-cert-snakeoil.key file, which is only readable by users that are members of the ssl-cert group

Add xrdp User to the ssl-cert Group

Shell
sudo adduser xrdp ssl-cert  
sudo systemctl restart xrdp

3. Disable the Compositor

The refresh rate on the RDP session is pretty slow, XFCE isn’t TOO bad (Unity & KDE were pretty un-usable for me), disabling the compositor makes it way better so I suggest doing just that.

You can disable the compositor via the GUI or via the terminal.

Terminal

Terminal
xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s false

GUI

Run Window Manager Tweaks

BAT
xfwm4-tweaks-settings

Click on Compositor and click Disable.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)