I'm using Mac OS X and running instances in the EU West Region. My instances are of the Amazon Linux AMI.
Installing the EC2 command line tools
Having command-line tools installed is a supplement to the AWS management console found online. I found a good tutorial about how to get started with the tools for EC2 on Mac OS X.
After downloading the tools from Amazon download site, the tutorial describes how to set environment variables and how to create X.509 certificates etc.
The only detail missing was that I'm running my instances in the EU West region. I found a hint in another tutorial on setting an additional environment variable. My resulting .profile file looks like this:
# Setup Amazon EC2 Command-Line Tools export EC2_HOME=~/.ec2 export PATH=$PATH:$EC2_HOME/bin export EC2_PRIVATE_KEY=`ls $EC2_HOME/pk-*.pem` export EC2_CERT=`ls $EC2_HOME/cert-*.pem` export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/ # This line is from second tutorial, for use with EU West Region: export EC2_URL=https://eu-west-1.ec2.amazonaws.com |
The first tutorial show many examples of using the command-line tools to start instances, open ports etc.
Package manager for Amazon Linux AMI
Maybe the tools can be used to install packages on the Amazon Linux AMI instance, but you could also use a package manager.
Amazon Linux AMI comes with the yum package manager installed. A tutorial which is specifically aimed at installing PHP on a Amazon Linux AMI instances also gives a quick tour of yum. Basically you do like this:
$ sudo yum install <PACKAGE_NAME> |
Installing Apache Web Server
As an example of using the EC2 tools and the yum package manager is installing the Apache Web Server. The command ec2-describe-instances lists running instances in the region given in the environment variable EC2_URL.
$ ec2-describe-instances
RESERVATION r-xxxxxxxx xxxxxxxxxxxxx default
INSTANCE i-xxxxxxxx ami-xxxxxxx ec2-xx-xxx-xx-xx.eu-west-1.compute.amazonaws.com |
default is the name of the security group for the instance. You may have used a different security group name. Security groups are used to make it easier to apply a set of permissions to a range of instances. The command ec2-authorize applies a permission to a security group, like opening up port 80 for httpd.
# open up port 80 on instances belonging to security group 'default' $ ec2-authorize default -p 80 PERMISSION default ALLOWS tcp 80 80 FROM CIDR 0.0.0.0/0 |
Logging into the instance with ssh and then using the package manager to install httpd.
# use the key pair that you used when launcing your instance $ ssh -i ~/.ec2/ec2-keypair ec2-user@c2-xx-xxx-xx-xx.eu-west-1.compute.amazonaws.com # install httpd - starts an install process $ sudo yum install httpd |
If you want to try Debian and Ubuntu AMIs i’ll recommend this site:
http://alestic.com/
/Rastermanden
This was very helpful and spared me a ton of configuration time!
The tip to do:
export PATH=$PATH:$EC2_HOME/bin
was great!
I get this error:
/home/ec2-user/bin/ec2-cmd: line 62: /System/Library/Frameworks/JavaVM.framework/Home//bin/java: No such file or directory
any idea how to solve it?
Hi,
I have installed local machine for slackware14.0 and I have created new image for 10GB using below command and
# dd if=/dev/zero of=Slack14.0 bs=1M count=10000 # mke2fs -F -j Slack14.0
#mount Slack14.0 /mnt/slackware14.o
and installed the custom package for slackware14.0
I have referred the below links and follow-up the steps, for pdf document.
http://aws.typepad.com/aws/2010/07/u…mazon-ec2.html
Download the kernel:-http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.34.4.tar.gz
I have untar the linux-2.6.34. kernel, I am getting 2 folders (/lib/modules & /boot) and installed the path like (/lib/modules folder in /lib path and boot file is stored in /boot path.
Also I have set the fstab entry for, and changed the above links steps also.
Create /etc/fstab and add the following entries to it:
/dev/xvda1 / ext3 defaults 1 1
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
And I have created the /boot/grub/menu.lst file and store the file
default 0
timeout 3
title kernel-2.6.34
root (hd0)
kernel /boot/vmlinuz root=/dev/xvda1 xencons=xvda1 console=xvda1 ro
and bundle with amazon aki (aki-407d9529) and upload the amazon server and register it,
While run the instance, I am unable to login the server, I am getting below error.
ec2-get-console-output i-ajht0c9
[6535502.143450] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[6535502.143828] ctnetlink v0.93: registering with nfnetlink.
[6535502.145187] ip_tables: (C) 2000-2006 Netfilter Core Team
[6535502.145235] TCP cubic registered
[6535502.145244] NET: Registered protocol family 17
[6535502.245110] XENBUS: Device with no driver: device/console/0
[6535502.247428] EXT3-fs: barriers not enabled
[6535502.257460] EXT3-fs (xvda1): mounted filesystem with writeback data mode
[6535502.257484] VFS: Mounted root (ext3 filesystem) readonly on device 202:1.
[6535502.257779] Freeing unused kernel memory: 484k freed
[6535502.257953] kjournald starting. Commit interval 5 seconds
[6535502.471724] mount used greatest stack depth: 4296 bytes left
[6535512.662690] touch used greatest stack depth: 4120 bytes left
[6535576.762574] xenbus_dev_shutdown: device/console/0: Initialising != Connected, skipping
[6535577.114477] Restarting system.
Thanks for advance
David