As Thilo Maier pointed out in comments on my request for UDS input, I have been publishing both server and desktop AMIs for running Ubuntu on EC2 up through Jaunty, but the official Karmic AMIs on EC2 only support server installations by default.
Ubuntu makes it pretty easy to install the desktop software on a server, and NX from NoMachine makes it pretty easy to access that desktop remotely, with near real-time interactivity even over slowish connections.
Here’s a quick guide to setting this up, starting with an Ubuntu 9.10 Karmic AMI on Amazon EC2:
Create a user-data script which installs runurl (not on Karmic AMIs by default) and then runs a simple desktop and NX server installation script. Examine the desktop script to see what it’s doing to install the software.
cat <<EOM >install-desktop #!/bin/bash -ex wget -qO/usr/bin/runurl run.alestic.com/runurl chmod 755 /usr/bin/runurl runurl run.alestic.com/install/desktop EOM
Start an instance on EC2 telling it to run the above user-data script on first boot. The following example uses the current 32-bit Karmic server AMI. Make sure you’re using the latest AMI id.
ec2-run-instances --key YOURKEY --user-data-file install-desktop ami-1515f67c
Connect to the new instance and wait for it to complete the desktop software installation (when sshd is restarted). This takes about 30 minutes on an m1.small instance and 10 minutes on a c1.medium instance. Then generate and set a secure password for the
ubuntuuser using copy/paste from the
pwgenoutput. Save the secure password so you can enter it into the NX client later.
ssh -i YOURKEY.pem ubuntu@THEHOST tail -f /var/log/syslog | egrep --line-buffer user-data: pwgen -s 16 1 sudo passwd ubuntu
If anybody knows how to use ssh keys with NX, I’d love to do this instead of using passwords.
Back on your local system, install and run the NX client. For computers not running Ubuntu, download the appropriate software from NoMachine.
wget http://126.96.36.199/download/3.4.0/Linux/nxclient_3.4.0-5_i386.deb sudo dpkg -i nxclient_3.4.0-5_i386.deb /usr/NX/bin/nxclient --wizard &
Point the NX Client to the external hostname of your EC2 instance. Enter the Login “ubuntu” and the Password from above. Choose the “Gnome” desktop.
If all goes well, you should have a complete and fresh Ubuntu desktop filling most of your screen, available for you to mess around with and then throw away.
If you want to have a persistent desktop with protection from crashes, you’ll need to learn how to do things like placing critical directories on EBS volumes.
If you’d like to run KDE on EC2, replace the package “ubuntu-desktop” with “kubuntu-desktop” in the installation script.