Tuesday, 18 November 2014

How to launch a virtual desktop on AWS


Did you ever get a GUI bug report which you couldn't replicate on any desktop at your disposal?

Last night was the first time for me, and here's my solution...




Source: Flickr, Image by Krystian "Krane" Schneidewind







Setup an AWS instance identical to the user's desktop.

In my case my student had a Debian 7 with a Gnome desktop: ami-d0318eb8


Install VNC server on the instance.

As root:

# apt-get update


tasksel install gnome-desktop --new-install
# apt-get install vnc4server


Start the VNC server on the instance.

To start the server you'll run something like this:

# vnc4server -geometry 1024x768 -depth 24

Log file is /root/.vnc/ip-10-29-240-166:1.log


Find out which port the VNC server is listening on...

The log file generated above contains the port number

# grep port /root/.vnc/ip-10-29-240-166:1.log

In my case it was port 5901


... and make that port accessible.

Make sure that port is accessible via TCP by updating the instance's AWS security group


Install a VNC viewer on your desktop...

My desktop is Ubuntu so I just called

$ sudo apt-get install xvnc4viewer


... and run it!

I called

$ xvnc4viewer ec2-54-146-137-134.compute-1.amazonaws.com:5901

where ec2-54-146-137-134.compute-1.amazonaws.com was the public URI of the AWS instance and 5901 was the port the vnc4 server was listening on.


Hey presto! I had a virtual desktop with very little installed on my desktop host. 
(Ok, I admit that I had to change the terminal's profile so that the background colour was different from the text...:)

Summary

I setup a virtual desktop using VNC (Virtual Network Computing) which is based on the Remote Frame Buffering protocol for communication between the client and server. There are various client and server implementations for you to install depending on the host boxes.


Footnote

It turned out it wasn't a GUI bug at all - it was a networking problem!

No comments:

Post a Comment