How to set up a desktop GUI with an Amazon EC2 instance

By | April 8, 2015

Set up an SSH tunnel plus a local private key using instructions from this link:

on ec2 ran these installers (not sure which ones are overkill – only that it eventually worked)

sudo apt-get update
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server
sudo apt-get install x11vnc
x11vnc -storepasswd
sudo apt-get install gnome-core gnome-session-fallback

vncserver -kill :1  #(to get the default xstartup file)

edit $HOME/.vnc/xstartup to look like this:


# Uncomment the following two lines for normal desktop:
#exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#x-window-manager &

had to set a password for the ubuntu user (gnome desktop seems to need this?)

sudo passwd ubuntu

had to reboot the instance

then ran

 sudo x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -auth /var/run/lightdm/root/:0 -usepw

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.