Enabling remote desktop on an ubuntu ec2 instance is pretty easy by using NX. We will use FreeNX at the server and NoMachine NX client on the client machine. NX is a much better alternative to VNC. You can install NoMachine client on windows, mac or linux. For more information visit http://www.nomachine.com
Here are the easy steps:
1) Install ubuntu desktop on your server instance
By default X server, GNOME etc is not installed on your ubuntu instance. You can install it by simply executing the following commands:
sudo -E apt-get update
sudo -E apt-get install -y ubuntu-desktop
It will install lot of stuff. So don’t get surprised if it takes 10 to 15 minutes to finish it.
2) Install FreeNX server on your server
The following commands assume that you are using ubuntu 9.10 (Karmic Koala) image.
sudo add-apt-repository ppa:freenx-team
sudo apt-get update
sudo aptitude install -y freenx
sudo /usr/lib/nx/nxsetup --install
If you are using older ubuntu versions, please visit FreeNX server installation page on ubuntu website to get the instructions for installing FreeNX server.
While executing the last command, you will get the following prompt:
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
I would say answer ‘N’ which is the default. If you answer Y, you will have to generate keys and put them at a specific location in the client.
3) Enable password authentication on the ssh server
Edit /etc/ssh/sshd_config and set PasswordAuthentication to yes. By default password authentication is disabled.
You will need to restart ssh process by executing
sudo /etc/init.d/ssh restart
Now that you have enabled password authentication, you should make sure that the the user you are going to use for using remote desktop has a password. Cannonical’s karmic images come with ‘ubuntu’ user. This user does not have a password. You can set a password by executing
sudo passwd ubuntu
4) Install and setup NX client
Now install the NoMachineNX client on your Desktop. You can download the client form http://www.nomachine.com/download.php. You can install it by simply double clicking the downloaded file. Once you install it, click on the NX Connection wizard to setup a new connection. Fill in the values as shown below. Make sure that you put in your server address in the host field.
And that’s it! NX client will create a desktop shortcut for the server connection (Only if you choose to do so). Double click the shortcut, fill in the username (ubuntu) and the password (set in step 3) and you are in!