We at NetPlenish are starting to use Selenium more and more, and we are doing it in the “cloud”. One of the first things i wanted to do was be able to watch my tests run on the system. So I needed to install VNC and ubuntu Desktop.

Its very strait forward.

Login as root.

`sudo su -`

Update the apt-get

`apt-get update`

Install ubuntu desktop

`apt-get install ubuntu-desktop`

I picked gnome for my display manager.

`apt-get install gdm`

Update xserver to work with the new gui.

`dpkg-reconfigure xserver-xorg`<span id="more-466"></span>Startup GDM

`/etc/init.d/gdm start`

Install the TightVNCServer

`apt-get install tightnvcserver`

Create a config file for gnome & VNC sessions Create a file called ‘xstartup’ and placed it in ~/.vnc make the file executable

`chmod +x xstartup`

`
unset SESSION_MANAGER
exec /etc/x11/xinit/xinitrc

# Fix keyboard maping so that you don't have to deal with asdf bug.
# https://bugs.launchpad.net/ubuntu/+source/control-center/+bug/108928
export XKL_XMODMAP_DISABLE=1

xsetroot -solid grey
vncconfig -iconic &
xterm -geomtetry 1024x768 -ls -title "$VNCDESKTOP Desktop" &
exec gnome-session
`

Make this file “/etc/x11/xinit/xinitrc” executable.

`chmod +x /etc/x11/xinit/xinitrc`

Restart the server and run vnc

`vncserver :1`

1 is the display number.  

If you want to stop the vnc server kill it.

`vncserver -kill :1`

Open up port 5901 for VNC in your firewall.

If by default you reject all in your IP Tables do:

`iptables -A INPUT -p tcp --destination-port 5901`

If by default you all all in your IP Tables do:

`iptables -A INPUT -p tcp --destination-port 5901`

Since I am on a mac, I chose Jolly Fast VNC so that I could connect to the VNC server.

Connect to vnc

I then needed to stop the “d” key from minimizing all the windows. Stop D Key From minimizing windows.

References