croome.org

  • blogs
  • photos
  • contact
Home › Blogs › simon's blog

Installing AMP on our Amazon EC2 AMI

simon — Sun, 23/12/2007 - 1:42pm

In http://croome.org/content/running-our-first-centos-5-virtual-machine-ama... we got out new EC2 vm running, now we need to update it with our application stack.

First, run an update against the base repository:

yum -y update

Enable the centosplus repository to get more recent package versions changing "enable=0" to "enable=1" in the centosplus section of /etc/yum.repos.d/CentOS-Base.repo.

Install MySQL:

yum --enablerepo=centosplus -y install mysql mysql-devel mysql-server mysql-admin

And Apache/PHP:

yum --enablerepo=centosplus -y install httpd php php-gd php-imap php-mbstring php-mysql

We don't want to start these just yet as we'll want to change their data directories first.

Next we'll setup a dynamic dns updater. I signed up with dyndns.org but I haven't looked into the pros/cons of other services.

wget http://cdn.dyndns.com/ddclient.tar.gz
tar zxf ddclient.tar.gz
cp ddclient-3.7.3/ddclient /usr/bin
cp ddclient-3.7.3/sample-etc_rc.d_init.d_ddclient /etc/rc.d/init.d/ddclient
mkdir /etc/ddclient
cat <<'EOF'> /etc/ddclient/ddclient.conf
# Basic configuration file for ddclient
#
# /etc/ddclient/ddclient.conf

daemon=60
syslog=yes
cache=/tmp/ddclient.cache
pid=/var/run/ddclient.pid
ssl=yes
login=******
password=******
protocol=dyndns2
server=members.dyndns.org
use=cmd, cmd='curl -s http://169.254.169.254/latest/meta-data/public-ipv4'
******.dyndns.org
EOF
/sbin/chkconfig --add ddclient
service ddclient start

Make sure it works by comparing the result of 'curl -s http://169.254.169.254/latest/meta-data/public-ipv4' with an nslookup:

curl -s http://169.254.169.254/latest/meta-data/public-ipv4
72.44.56.125
nslookup ******.dyndns.org
Server: 172.16.0.23
Address: 172.16.0.23#53

Non-authoritative answer:
Name: ******.dyndns.org
Address: 72.44.35.7

So it failed. Looking in /var/log/messages I can see I'm missing the perl SSL module:

ddclient[2257]: FATAL: Error loading the Perl module IO::Socket::SSL needed for SSL connect.

Once installed and the service restarted, it checks out ok:

yum install perl-IO-Socket-SSL
service ddclient restart

Now let's save what we've done into our own AMI image.

ec2-bundle-vol -c -k -u

To save it, create an S3 "bucket" and then upload the image.

export AWS_ACCESS_KEY_ID="youraccesskey"
export AWS_SECRET_ACCESS_KEY="yoursecretaccesskey"
s3cmd createbucket ami.croome.org
ec2-upload-bundle -b ami.croome.org -m /tmp/image.manifest.xml -a "youraccesskey" -s "yoursecretaccesskey"

Now we just need to register the image so we can boot instances of it:

/home/ec2/bin/ec2reg -K /mnt/prv.pem -C /mnt/pub.pem ami.croome.org/image.manifest.xml

I can now see that the image is available for my use, and can create a new instance of it:

ec2-describe-images
IMAGE ami-c723c6ae ami.croome.org/image.manifest.xml 665251303620 available private

ec2-run-instances ami-c723c6ae -k drupal
RESERVATION r-5301e93a 665251303620 default
INSTANCE i-36f9085f ami-c723c6ae pending 0 m1.small 2007-12-23T13:44:35+0000

  • Apache
  • EC2
  • Linux
  • MySQL
  • simon's blog
  • Login or register to post comments

Services

suramdi616 — Sat, 20/02/2010 - 8:07pm

Don't use singular to cover an asthma attack that has already set out. It leave not work buy singulair fast plenty to turn your symptoms. Employ only a quick-acting aspiration medicament to cover an bronhial asthma attack..

  • Login or register to post comments

Navigation

  • Blogs
  • Photos
  • Recent posts
  • blogs
  • photos
  • contact