graphical ubuntu for VNC

As part of another project, I wanted to have a Ubuntu GUI under GCE, and tried a few things but captured what I did to make it work. I’ve found this works for the Trusty and Vivid releases, whether you start with the server or desktop versions. The reason I used this in a desktop version is that I was unable to make gnome-session work with vnc4server in Vivid.


sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vnc4server xubuntu-desktop xfce4
vnc4server :2
vnc4server -kill :2

edit ~/.vnc/xstartup, comment out the x-window-manager and add:

xfce4-session &

Then restart the vnc session:

vnc4server -geometry 1600x1200 :2

(pick your favorite virtual screen size)

login with ssh and port forwarding of 5902:

ssh -L 5902:  -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no jeffreypaulanderson_gmail_com@YourGoogleInstanceIPAddress

Then you can fire up a local vnc session on port 5902, which in OSX is done via the finder, apple-K, then vnc://localhost:5902

The vnc session goes through the ssh tunnel so no need for other firewall settings or anything.

Worked pretty well.

Leave a Reply