Tuesday, July 12, 2011

Enabling X11 Forwarding to Ubuntu on AWS

If you're using Amazon Web Services EC2, you probably discovered that the RightScale Linux images are very good starting points. The Ubuntu server image is a good starting point for many standard dev or demo purposes. Usually the ssh session is good enough, but recently I wanted to run JConsole on the server to access some MBeans published by the graph database Neo4J.

Here are the changes I made to my basic server set up script (you do automate all the steps you like to apply to any new EC2 image, right?). Add 2 X-related packages and switched from the headless OpenJDK to the full OpenJDK:
apt-get install xauth -y
apt-get install x11-apps -y
#need full jdk, not headless in order to run jconsole as UI
#apt-get install openjdk-6-jre-headless -y
apt-get install openjdk-6-jdk -y

And remember to update your SSH command to include trusted X11 forwarding
ssh -i root@.compute-1.amazonaws.com -Y -C