Jaa


Running a Remote Desktop on a Windows Azure Linux VM

A complete click-by-click, step-by-step video of this article is available here.

 

OR… You can read the article, line-by-line.

It all starts with a Linux Server running in the Windows Azure cloud…

image

Onto this you’ll install a remote desktop protocol (RDP) server called xrdp.

image

But to get this server software installed, you need to configure the Linux server. You’ll use your workstation to do this with an SSH client such as PuTTY. You’ll need to connect port 22 from the LINUX server up to the Internet. Then you can use the PUTTY client on your workstation to connect over SSH.

image

That gives you a command prompt. That’s as much as you need to get the XRDP server installed, running and ready to accept connections from the outside world.

image

You type a series of commands which will download and install the XRDP server on to your LINUX machine.

You can then fire up a local Remote Desktop client, such as the one that comes with Windows, if you are on a windows machine. Depending on the version of Windows you are using you can find it by searching for either “Remote Desktop” or “mstsc”. You can also connect directly from the Windows Azure portal by downloading the RDP file from the server.

image

Let’s have a look at how this is all achieved, click-by-click.

In the Windows Azure Portal, I create a new Virtual Machine. In this case I’m creating an Ubuntu Server 12.04 LTS. I specify the latest version release date, the machine name, the size of the VM, and I create an administrative, or root user – in this case “planky”. To keep things simple I avoid certificate authentication for the SSH session and just use a password.

image

I specify to create a new cloud service and I keep the default name. I then pick the Windows Azure subscription I want to use and pick a data centre to deploy to – in this case I use North Europe which is located in Dublin, Ireland, because that’s the closest Data Centre to me. You can see I pick one of my existing storage accounts. If you don’t already have one you want to use, just get the portal to automatically generate a storage account for you. I don’t worry about an Availability Set.

image

I make sure the SSH endpoint is connected to the load balancer. It’s set by default on port 22.

image

It takes a few minutes for the machine to provision.

I can get the DNS name of the server from the Dashboard. I just copy it in to the paste buffer.

image

If you already have an SSH client installed, you can paste the name in to it. I’ve got PuTTY installed. If you need to install a client at this stage, you could go to https://aka.ms/putty and download the puTTY client. Once installed, enter the DNS address and click connect.

image

A security message pops up to warn you that there is a chance that the server you are connecting to is not the one you think it is. For example if a hacker managed to modify the DNS settings in your computer. The message hints there are ways around these problems. The message is rather similar to the ones you get from the Remote Desktop client.

If you are happy you are not being misled, then go ahead, as I do in this case. I now log in as the root user I specified when I created the VM in the Windows Azure portal.

image

All the commands you are about to run need to be done at an elevated privilege. There is a rough approximation to the Windows “Run as Administrator”, known as “sudoo” or “SuDO”. This means “super-user do”. You specify this keyword and the following command is run at the elevated privilege level. That is, as long as the account you are logged in to is a superuser – which this one is.

Linux uses the notion of “packages”. The packaging system uses a special database to keep track of which packages are installed, which are not installed and which are available for installation. apt-get is a command that uses the database to find out how to install packages and find out which additional packages are needed for a selected package to work properly.

To update this list, I type sudo (that is, run in superuser context) apt-get update image

You now need patience as a slew of information is dumped to the screen, and continues to do so for some minutes.

I now install a GUI dektop on to the Ubuntu server. In this case I use the Gnome desktop and the command is:

sudo apt-get install ubuntu-desktop

There is a warning about the amount of disk space this will take, but I’m happy with it and select “yes”.

…again you need some patience.

Once the desktop is installed, I need the rdp server so I can expose the desktop over a network connection. It’s a similar command:

sudo apt-get install xrdp

…and even though the console says the RDP server is started, experience shows me it hasn’t so I type

sudo /etc/init.d/xrdp start

Next I add a user that I want to be able to use the Remote Desktop with

sudo adduser primech. The “primech” bit is the username. You get prompted for some other user-type data.

…now, probably the first thing the user will want to do, because it’s probably going to be you, is to install packages and configure the system. So they need to be added to the sudo group with

sudo adduser primech sudo

Great! So now the internals of the Ubuntu Linux server are all set up. I now need to get it communicating over the Internet on the RDP port. By default, on a Linux Server, this port is not set up, like it is on a Windows Server.

In the portal I go to the endpoints tab and Add a new endpoint.

I specify a Standalone Endpoint and then on the next page select Remote Desktop and in this case leave both the public and private ports at 3389.

image

That’s the default port for RDP connections. The portal connects port 3389 from the Linux Server to the load balancer. It then connects port 3389 from the load balancer to the internet and maps the external port to the internal one. SO anybody now coming in to this service on port 3389 will be taken straight to the Linux Server on port 3389 and the RDP server running in the Linux Server will respond.

Flipping back to the virtual machines page in the portal, now the Remote Desktop Protocol is configured, the “CONNECT” icon at the bottom of the screen is available.

image

Clicking this now gives a very similar experience to connecting to a Windows Server only the logon page is coming from the Linux Server. Enter the username and password of the user you just created and you’ll be logged in to the Gnome desktop.

image

As a general rule, you’ll find the desktop and RDP server are not as optimised for network usage as the Windows desktop, but it’s still a very usable system.

Here is a screenshot of the Linux desktop where I use Firefox to connect to the Windows Azure portal. I can see the portal that is managing the server I’m connected to.

image

Now, as the captain of a 747 says, when he needs a coffee – “you have control”.

If you want to try any of this stuff out for free on Windows Azure, get a free Windows Azure subscription at https://aka.ms/azure_trial.

You can try up to 30 different labs on Azure using the free training kit, downloadable from https://aka/ms/watk.

You can watch the video of this with step-by-step and click-by-click commentary on the Channel 9 Website.

Or watch it right within this page:

Comments

  • Anonymous
    January 03, 2014
    Awesome tutorial. Thanks
  • Anonymous
    January 14, 2014
    Can you provide instructions on how to get this working on the Ubuntu 13 images? I have mine running but the desktop just shows up as plain grey with no desktop or event terminal. I think it has something to do with default 3d support in Ubuntu desktop but I do not know how to properly configure this to work over RDP or VNC. Thank you for your help!
  • Anonymous
    January 31, 2014
    very easy to follow tutorial, thanks. I followed all the steps, but unfortunately after logging in to the RDP what I got is a grey screen, mouse pointer in a form of X, no wallpaper and I can't even open a console with Ctrl+Alt+T. I even restarted the VM. Any ideas on what I did wrong?
  • Anonymous
    February 01, 2014
    Very good tutorial, thanks. I'm having a problem though - after following each step all I got is a grey screen when connecting from Windows machine. Any ideas about why that is? I launched VM with 750Mb of memory, may be it's too small for a desktop Linux?
  • Anonymous
    February 17, 2014
    Nice! thanks for a straight forward step-by-step example of how to get this running.. I tried a couple of other methods (using xRdp too) but didn't work.. so many thanks for sharing, and the http://aka.ms/azure_trial site too!
  • Anonymous
    March 17, 2014
    What a AMAZING tutorial.You explain everything so well.
  • Anonymous
    March 25, 2014
    I tried this solutions from another site (http://www.techzim.co.zw/2013/12/solving-ubuntu-13-10s-remote-desktop-windows-bug/) and use the original user to login instead.
  • Anonymous
    April 07, 2014
    原文链接: http://blog.csdn.net/mantgh/article/details/18284661
    Windows Azure是微软的云服务集合,用来提供云在线服务所需要的操作系统与基础存储与管理的平台
  • Anonymous
    April 09, 2014
    i only need remote access to my db ,which is on my VM of windows azure , how can i achieve my target ?
  • Anonymous
    April 18, 2014
    Excellent video instruction. Love it
  • Anonymous
    May 05, 2014
    Did anyone get the grey screen on connect and then resolve it? that's all I see as well - a grey screen with only a cursor that I can't control.
  • Anonymous
    June 04, 2014
    I think the issue with the grey screen may be related to the install over Ubuntu 14. See this post

    http://askubuntu.com/questions/449785/ubuntu-14-04-xrdp-grey

    Haven't tried the work around yet
  • Anonymous
    June 18, 2014
    I followed all the steps mentioned in this article. (It is a great piece :) )
    But once i login, i just get a blank screen. Nothing happens whichever key i press.
    Any pointers to this?
  • Anonymous
    July 23, 2014
    Cool
  • Anonymous
    July 28, 2014
    Thanks. Great tutorial. Make sure you use Ubuntu Server 12.04 as 14 doesn't work with xrdb.
  • Anonymous
    September 08, 2014
    Thank you very much !!!!!!!!!!!!!
  • Anonymous
    September 09, 2014
    Very nice tutorial - thank you!
  • Anonymous
    September 25, 2014
    Exellent article. Great. Thank you
  • Anonymous
    December 17, 2014
    Finally an Azure tutorial even I can follow. You should be running Microsoft.
  • Anonymous
    January 20, 2015
    Thank you for the excellent article.
  • Anonymous
    April 15, 2015
    Converting Azure PowerShell scripts to Linux Scripts.
    In one of my recent customer engagements, I was
  • Anonymous
    April 16, 2015
          Converting Azure PowerShell scripts to Linux Scripts. In one of my recent customer
  • Anonymous
    June 11, 2015
    Great guide. Worked like a charm.
    Thank you!
  • Anonymous
    June 26, 2015
    Very useful and clean tutorial. Thank you for the sharing.
  • Anonymous
    July 11, 2015
    Thanks for the instructions.

    For Ubuntu versions after 12.10, you'll have to replace

    sudo apt-get install ubuntu-desktop

    with some other desktop. You can install XUbuntu with xfce or just xfce alone, if you prefer something lightweight without all desktop apps. I did as follows:

    sudo apt-get install xfce4
    echo xfce4-session >~/.xsession

    and added Firefox web browser just because I sometimes need it on the server:
    sudo apt-get install firefox

    Everything else can be done as told in this article.
  • Anonymous
    October 23, 2015
    GREAT!!!!! THANK YOU
  • Anonymous
    November 26, 2015
    Great post, many thanks!
  • Anonymous
    January 13, 2016
    Hello Do u have a Solution for me, when I don't have Internet?
  • Anonymous
    January 20, 2016
    Please provide steps to connect Linux vm created using ARM using SSH
  • Anonymous
    January 21, 2016
    Great ! Thanks !
  • Anonymous
    February 03, 2016
    Hi,

    Nice article but after rdp its working slow is there any option to speed up
  • Anonymous
    October 05, 2016
    There is a mistake in your sudo code : mistake->"sudo get-apt update"correction->"sudo apt-get update"
  • Anonymous
    April 07, 2017
    To solve the grey screen with a cross as an arrow... see http://c-nergy.be/blog/?p=8952Ubuntu 16 doesn't support xrdp.