Tuesday, September 03, 2013

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

·         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="<WIDTH>x<HEIGHT>"

#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.

 

No comments:

A little about Me

My photo
My name is Mitch Beaumont and I've been a technology professional since 1999. I began my career working as a desk-side support engineer for a medical devices company in a small town in the middle of England (Ashby De La Zouch). I then joined IBM Global Services where I began specialising in customer projects which were based on and around Citrix technologies. Following a couple of very enjoyable years with IBM I relocated to London to work as a system operations engineer for a large law firm where I responsible for the day to day operations and development of the firms global Citrix infrastructure. In 2006 I was offered a position in Sydney, Australia. Since then I've had the privilege of working for and with a number of companies in various technology roles including as a Solutions Architect and Technical team leader.