Thursday, December 4, 2008

Building a CentOS 4 AMI: Part 1 of 2

Building a new AMI for Amazon's Web Services takes as much time prepping your target system as does creating the AMI itself. There are system requirements, some, aren't taken care of depending on the distribution you're using.

Case in point, I'm building a CentOS 4 AMI. Why? Because CentOS / Red Hat 5 it all over and there are some applications that require older versions. ISOdx, the project I've been on for the past 6 years, grew up on Red Hat 3 and now runs on Red Hat and CentOS 4. I'd love to invest the time in getting the RPM's up to snuff so it'd run on v5 but I have bigger fish to fry.

What I settled on was CentOS 4.7. It's the most recent and release in the v4 release. After downloading the DVD copy of the distribution, I built a VMware server and installed almost everything, after all, you never know what you're going to need. There was some additional software and updates required. Here are some I've identified.

From http://aws.amazon.com/
  • ec2-ami-tools.noarch.rpm
  • ec2-api-tools.zip
From http://www.java.com/
  • jre-6u7-linux-i586-rpm.bin
Located using http://RPMfind.net/
  • tar-1.15.1-1.i386.rpm
From http://dev.centos.org/centos/4/testing/i386/RPMS
  • ruby-1.8.5-1.el4.centos.i386.rpm
  • ruby-libs-1.8.5-1.el4.centos.i386.rpm
I won't bore you with the downloading and installing. That ought to be straight forward enough. It will be evident from some paths where I unpacked things on my system. It may not be the perfect place but it works.

Next, I had to tweak my shell environment.
export EC2_HOME=/root/ec2-api-tools-1.3-24159
export JAVA_HOME=/usr/java/jre1.6.0_07
Yes. I'm logged in as root. Don't panic. It's a virtual machine that I may trash and I've been doing this since 1988. Yes, 1988. Older than some who may read this so you youngsters just settle down. Where's my spectacles?

Needless to say, you'll need a AWS account as well as the private key and cert. Having them on the system is very helpful and I stored them in /root/.amazon plus setup the following shell variables.
export EC2_PRIVATE_KEY=/root/.amazon/pk.pem
export EC2_CERT=/root/.amazon/cert.pem
And, finally we'll add to the path the bin directory for the EC2 tools.
export PATH=$PATH:$EC2_HOME/bin
Next post, which I hope occurs before the next turn of the century, I'll explain the a simple process of building the actual CentOS 4 AMI, uploading it, and eventually starting the thing.

No comments: