Alexander Zeitler

Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM

Published on Wednesday, June 1, 2016

TL;DR: While boring looking XFCE installation on Ubuntu Server is shown everywhere, this post shows you how to get a nice Mate Desktop on Ubuntu in Azure up and running and RDP into it.

In Windows Server environments you just spin up a Server and have a GUI, install Visual Studio and start developing.

But with Ubuntu Server things get a little bit more complicated.

I've chosen (read: learned to choose) Mate Desktop, because it is one of the environments that looks pretty nice but doesn't require 3D acceleration enabled which you just don't have in cloud environments (at least not in the general compute instances).

First, create a Azure VM instance of your choice with a username and password, enable inbound Port 3389 (RDP) in its NIC security group settings and SSH into it.

Enabling Port 3389 for RDP, first select "Network interfaces":

Next, select the "Network security group":

Select "Inbound security rules":

You'll see the default inbound rules:

Add a new rule for RDP via port 3389:

Check the updated inbound rules:

After that, install the latest updates:

sudo apt-get udpate
sudo apt-get upgrade
sudo apt-get dist-ugprade

With that done, install the Ubuntu Mate desktop and xrdp:

export DEBIAN_FRONTEND=noninteractive
sudo apt-add-repository ppa:ubuntu-mate-dev/ppa
sudo apt-add-repository ppa:ubuntu-mate-dev/trusty-mate
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install --no-install-recommends ubuntu-mate-core ubuntu-mate-desktop
sudo apt-get install mate-core mate-desktop-environment mate-notification-daemon
sudo apt-get install xrdp

Now, make Mate the default desktop environment for xrdp sessions (also for new users being created afterwards):

echo mate-session> ~/.xsession
sudo cp ~/.xsession /etc/skel

Finally, we'll allow changing the host post port we can connect to (this allows reconnecting to an abandoned session):

sudo vim /etc/xrdp/xrdp.ini

Change port=-1 in the [xrdp1] section to port=ask-1.

With the changes done, restart xrdp:

sudo service xrdp restart

Now we're able to RDP into our Azure VM from Windows:

You should get the xrdp login screen were you enter your users credentials and make sure sesman-Xvnc module is selected:

If everything went well, you should get this connection log:

After a second or two, you should also get the Ubuntu Mate desktop screen:

If you think we're done now: no.

Running software in the Mate environment

Here are some tips for running software in that environment.

Ubuntu Software Center

First of all, Ubuntu Software Center doesn't work due to some configuration errors I didn't get behind.
So if you have some nice .deb packages like Dropbox, just install them via Terminal:

sudo dpkg -i <package>.deb

Changing the timezone

If you want to change the timezone of your instance, you can't unlock and edit the setting in the UI.

Thus, you have to run sudo dpkg-reconfigure tzdata in Terminal and select the appropriate setting.

Dropbox

If you plan to install Dropbox, just download the .deb file and install it as described before.
You can start Dropbox using start dropbox -i to install the daemon.

After the installation you might see a weird or even no notification icon.
Just restart your Azure VM and everything should be ok.

If you still experience issues, you can also install caja-dropbox with is optimizied for the caja file manager of MATE.

Restart / Shutdown via Mate

Speaking of restarting: You might notice that using the Mate logout / shutdown / restart feature won't end your RDP session. Just use sudo reboot or sudo shutdown now -h in Terminal.

Visual Studio Code / ATOM

It just doesn't work in xrdp environments as of now - even with the latest Insider build installed.

Today I published a gist which describes a fix to get VS Code / ATOM in Ubuntu via RDP working.

I would be happy if you share further tips in the comments.

What are your thoughts about
"Deploying Ubuntu Mate Desktop as a developer environment in a Azure VM"?
Drop me a line - I'm looking forward to your feedback!
Please be aware that I'm no longer active on social media. I'm just cross posting things over there (it's a bot).
Imprint | Privacy