Using AWS Micro Instances to test my RDS Application: Part 1

Sep 3, 2013 16:44 · 340 words · 2 minute read

· Launch a t1.micro instance using an Ubuntu AMI

· Connect to the instance via SSH using the associated private key (remembering to append “ubuntu@” to the start of the instance IP if you’re using putty or some other terminal tool.

· Run sudo apt-get update

· Run sudo apt-get install vnc4server

· Run vncserver :0

· Set a password for your VNC connection

· Edit the xstartup file within ~/.vnc/ folder, remove the last couple of lines and add in a line for gnome-session&

· Should look a bit like this…

#!/bin/sh

# Uncomment the following two lines for normal desktop:

# unset SESSION_MANAGER

# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

gnome-session&

· Next run sudo nano /etc/init.d/vncserver

· Within the nano within paste the following: (remember to modify the USER variable to be the name of your current user, note the DISPLAY variable, this is the port number / session ID)

#!/bin/sh -e

### BEGIN INIT INFO

# Provides:          vncserver

# Required-Start:    networking

# Default-Start:     3 4 5

# Default-Stop:      0 6

### END INIT INFO

PATH="$PATH:/usr/X11R6/bin/”

# The Username:Group that will run VNC

export USER="ubuntu”

#${RUNAS}

# The display that VNC will use

DISPLAY="1”

# Color depth (between 8 and 32)

DEPTH="16”

# The Desktop geometry to use.

#GEOMETRY="x

#GEOMETRY="800x600”

GEOMETRY="1024x768”

#GEOMETRY="1280x1024”

# The name that the VNC Desktop will have.

NAME="my-vnc-server”

OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”

. /lib/lsb/init-functions

case “$1” in

start)

log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”

su ${USER} -c “/usr/bin/vncserver ${OPTIONS}”

;;

stop)

log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”

su ${USER} -c “/usr/bin/vncserver -kill :${DISPLAY}”

;;

restart)

$0 stop

$0 start

;;

esac

exit 0

· Press CTRL + X and save the file

· Run “sudo update-rc. /etc/init.d/vncserver defaults”

· Reboot by running “sudo reboot”

· Launch VNC viewer enter the IP address followed by the “:1” or whatever port your chose.

· Hit Connect and you should be logged in.