Home > Amazon Web Services, Ubuntu > Build a Ubuntu Amazon EC2 Instance

Build a Ubuntu Amazon EC2 Instance

December 3, 2011 Leave a comment Go to comments

# Steps to create Ubuntu Amazon EC2 Instance
– Login your AWS Management Console.
– Go to EC2 tab, then ‘lunch an instance’
– Select classical wizard -> community AMI -> search for ubuntu AMI (ubuntu official ID: 099720109477) You can even try different version of the ubuntu. (Link http://uksysadmin.wordpress.com/2010/11/21/amazon-ec2-ubuntu-quickstart-guide/)

# Login Your Instance

*If using Putty:
generate the key pair, save the value(ec2.pem file), which is important.
Download the PuTTYGen, import the ec2.pem file, select “Type-of-key-to-generate”: SSH1
Then save the private key. import the key into Putty, and from your running instance, copy the ‘Public DNS’ to the Host-Name of Putty.
Difference with Amazon EC2 Linux (using ‘ec2-user’ ), here the connection->data->auto_loing_user_name is ‘ubuntu’

* Access EC2 Instance by ssh
Change the private key readable to the owner only
$ chmod 400 ec2.pem

To access by SSH ( after @ is your public DNS, which will be difference each time when you restart your instance):
$ ssh -i ec2.pem ubuntu

# Check to see if your EBS already attached
sudo fdisk -l

# Ater creating EBS volume and attaching to the AMI using the AWS console:

#Formatted:
mkfs -t ext2 /dev/sdf
#Created mount point (in my case a backup directory):
mkdir /backups
#Mounted it:

mount /dev/sdf /backups
#Edited rc.local:
added mount /dev/sdf /backups to the end which mounts the EBS directory on bootup.

Linux Devices: /dev/sdf through /dev/sdp
Note: Newer linux kernels may rename your devices to /dev/xvdf through /dev/xvdp internally, even when the device name entered here (and shown in the details) is /dev/sdf through /dev/sdp

# To update Amazon EC2 instance which starts out with a default set of software. To install security updates and other pieces of software, run the following commands, in order:

$ apt-get -y update
$ apt-get -y dist-upgrade
$ apt-get -y install mercurial less python-matplotlib unzip bzip2 zlib1g-dev ncurses-dev python-dev

# Install pip and virtualenv for Ubuntu 10.10 Maverick and newer. Pip is a better alternative to Easy Install for installing Python packages.

$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install –upgrade pip
$ sudo pip install –upgrade virtualenv

# install Easy Install on Ubuntu Linux
$ sudo apt-get install python-setuptools python-dev build-essential

# Install whatever you want, here’s my list: R, rpy2, numpy, bpython (use Pygments)
$ sudo apt-get install r-base r-base-dev
$ sudo apt-get update
$ sudo apt-get update
$ sudo apt-get install python-pip python-dev build-essential

$ sudo apt-get install python-setuptools python-dev build-essential
$ sudo easy_install rpy2
$ sudo apt-get install python-numpy
$ sudo easy_install Pygments
$ sudo easy_install bpython
$ sudo apt-get install python-scipy

# Useful Resources

http://jonathanhui.com/create-and-launch-amazon-ec2-instance-ubuntu-and-centos
http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/
http://www.turnkeylinux.org/blog/ebsmount
http://jonathanhui.com/create-and-launch-amazon-ec2-instance-ubuntu-and-centos
http://wiki.bitnami.org/cloud/how_to_connect_to_your_amazon_instance

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: