Installing and Running PXN8 on an Amazon EC2 instance

[updated – see end of post]
Over the weekend I got to try out Amazon’s EC2 (Elastic Computing Cloud) service.
Google seem to get all the love from the blogosphere but Amazon have been doing cool stuff for years. Amazon were WebService pioneers. I started playing around with their webservices in 2003. S3 was interesting but EC2 is very compelling from a developer perspective.

EC2 is a service which basically offers dedicated hosting at what seems like a compelling price. I’m currently paying $160/month to my current provider and EC2 offers similar hosting for $72 / month. What’s not to like ? With EC2 you can configure and run multiple server images (all the images are based on RedHat Fedora Core).

What better way to kick the tyres on EC2 than by installing the PXN8 photo-editing application on an EC2 instance ? The procedure for configuring and running an EC2 Server (also known as an Instance) is relatively straightforward – just be sure to read the appendix if you’re using putty on Windows) and is documented on Amazon’s Developer website so I won’t cover it here. The following is a list of things I did to get PXN8 up and running on an Amazon EC2 instance. I figure some of my customers may eventually go this route too so I hope it comes in useful. At the very least it also offers a useful guide to setting up PXN8 on a Fedora Core box…

First off, for some bizarre reason, the default EC2 image doesn’t come with GCC installed (at least on my instance it wasn’t present)…
[1] Install GCC (if not already present)
$ which cc
if no cc is found…
$ yum install gcc

[2] Install libjpeg-devel (needed for imagemagick)
$ yum install libjpeg-devel

[3] Install LWP::Simple (needed by pixenate)
$ perl -MCPAN -e shell
> install LWP::Simple
> quit

[4] Install ImageMagick from source …
[4.1] $ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
[4.2] $ gunzip -c ImageMagick.tar.gz | tar xvf –
[4.3] $ cd ImageMagick-6.?.?
[4.4] $ ./configure –with-perl=/usr/bin/perl
[4.5] $ make; make install

[5] Ensure that the ImageMagick libraries will be picked up by the system.
Edit /etc/ld.so.conf and add the following line to the end of the file…
/usr/local/lib/

Then run the following command to update the library database…

$ /sbin/ldconfig

[6] Test that PerlMagick works…

$ perl -MImage::Magick -e 1

(If the output from this command is blank then all is well. If instead you get an error saying the Image::Magick module can’t be found then read http://jim.mmdc.net/archives/2004/12/getting_imagema.html)

[7] Configure Apache to run perl scripts…

edit /etd/httpd/conf/httpd.conf and add the following line…

AddHandler cgi-script .pl

Add the ExecCGI option to the DocumentRoot folder declaration.

[8] Download and Install PXN8

$ wget –user=${user} –password=${password} http://sxoop.com/release/${date}/pxn8.tar.gz
$ mv pxn8.tar.gz /var/www/html/pxn8.tar.gz
$ tar -xzvf pxn8.tar.gz

[9] Test the install…

go to http://domain/pixenate/themes/toolbar1/index.html

and try editing an image.

I must admit it took a bit of trial and error. ImageMagick wasn’t installed by default. When I tried installing using ‘yum install’ , PerlMagick wouldn’t work. I installed from source but there was no JPEG support. Eventually I got it working using the steps above.
This post is for my own and customer’s reference.

You can see PXN8 running on EC2 here…

UPDATE:
It took a full day after playing around with EC2 but the penny did eventually drop ;-) Essentially what EC2 is (and I think most of the journalists covering this have missed) is a Server Provisioning API. What it means is you can put a system in place that requests new servers as your load increases. This is the on-demand aspect – most of the coverage of EC2 has focussed on the pay-as-you-go aspect when in reality it’s the programmability of EC2 that is the really exciting stuff. Amazon are changing the game !

Advertisements

10 thoughts on “Installing and Running PXN8 on an Amazon EC2 instance

  1. Roger says:

    Don’t forget that all your changes to the base image will disappear when the machine is terminated: http://tinyurl.com/ehqjv

    To keep your instance info, you have to create a new AMI (image) and save it to S3.

    Roger

  2. Amazon.com’s S3 and EC2 Services

    Amazon.com recently announced their latest grid-computingenvironment, EC2 (Elastic Computing Cloud). This release comes on the heels of their S3 service, which allows users to programmatically store data on Amazon’s servers at a flat rate.

    I will …

  3. Bill Burcham says:

    I gather that EC2 doesn’t yet support me registering my own domain name yet. Is that right? Any insight on how that might be done or when it might be possible?

  4. sxoop says:

    Bill,
    As far as I know Amazon have no plans to support assigning your own domain-name to instances. It isn’t really like regular web-hosting. The instances are meant to be created and torn-down as required. The instances aren’t really meant to be permanent so assigning domain-names to them probably isn’t part of the deal.

  5. David Hinckle says:

    Bill, Amazon has published a PDF for developers that outlines the functionality you’re looking for.

  6. Lal says:

    Walter,
    Be interested in hearing your ‘real-life’ usage of EC2?
    OR are u still dabbling with it?

    especially if u can run up (on-demand or manual kickoff) extra instances 2 handle (digg/slashdot) loads

  7. naisioxerloro says:

    Hi.
    Good design, who make it?

  8. aaron abelard says:

    I’ve been running an EC2 instance for several months now. They’re very handy as development environments. I spin one up for a project and shut it down when the project is completed. You can assign domains to the IP’s you are given. Good luck!

  9. Carl says:

    Thanks for the helpful instructions!!! I just used them to install ImageMagick on my first ec2 AMI. This probably saved me a few wasted hours.

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: