Installing a graphical desktop to Ubuntu on Amazon EC2

Amazon’s EC2 service offers an interesting diversity of cloud computing. From less than a dollar an hour, you can run a powerful virtual machine on their hardware. View my previous post on setting up an Ubuntu machine with R.

I was interested in playing some with this infrastructure, and now installing a graphical interface, GNOME, on a Ubuntu machine. After setting up an Ubuntu 10.10 machine from these instructions, set up remote access with these instructions:

1. Install ubuntu desktop

export DEBIAN_FRONTEND=noninteractive

sudo -E apt-get update

sudo -E apt-get install -y ubuntu-desktop

2. Install FreeNX server on your server

sudo add-apt-repository ppa:freenx-team

sudo sed -i ‘s/maverick/lucid/g’ /etc/apt/sources.list.d/freenx-team-ppa-maverick.list

sudo apt-get update

sudo aptitude install -y freenx

The freenx server is from Lucid, but it works on Maverick, however it is missing the setup script, download it using wget:

wget https://bugs.launchpad.net/freenx-server/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz

tar -xvf nxsetup.tar.gz

And install:

sudo cp nxsetup /usr/lib/nx/nxsetup

sudo /usr/lib/nx/nxsetup –install

When it asks you:

It is recommended that you use the NoMachine key for
easier setup. If you answer “y”, FreeNX creates a custom
KeyPair and expects you to setup your clients manually.
“N” is default and uses the NoMachine key for installation.

Enter “N”

3. Enable password authentication

sudo vi /etc/ssh/sshd_config

edit the line:

PasswordAuthentication no

change it to

PasswordAuthentication yes

Then, enter:

sudo /etc/init.d/ssh restart

Then, set a password for the user ubuntu:

sudo passwd ubuntu

4. Install the client on your machine:

Download the NX client for your machine from http://www.nomachine.com/download.php

Run the client and enter on the host address field, your server’s address, then, on the next window, select UNIX and GNOME. The client will ask you for the username and password (ubuntu and the password from step 3).

This will use most of the screen. If you want to run it in a smaller size, click on “Configure…” and change the Display settings:

Click OK, then Login.

Once you are logged in, you will be able to see the GNOME desktop:

When you start a new instance from an AMI that already has NX installed, it won’t work. You’ll have to purge it and reinstall it, but it takes a few seconds:

sudo apt-get purge freenx*

sudo apt-get autoremove

sudo apt-get install freenx*

sudo /usr/lib/nx/nxsetup –install

From these sources:

This entry was posted in Cloud Computing, Ubuntu. Bookmark the permalink.