Alfresco 4.0 in Amazon EC2

Blog Post created by wabson Employee on Oct 16, 2011
Update January '12: These instructions are now deprecated. A simpler procedure, allowing easy creation of EBS-boot images is now documented as a follow-up post.

I've just added a new AMI for Alfresco 4 onto my Alfresco EC2 Images list. Running these files is now even easier, based on the method used by Eric Hammond's alestic.com, with a link next to each image that allows you to click directly through to the AWS Management Console. If you have an AWS account, you're now just a few clicks away from launching your own cloud-based instance of Alfresco 4.0.

Of course, the usual disclaimers apply here. These are not official images in any way, and should not be used for production purposes. But if you want to try out Alfresco 4 without the hassle of managing your own install, hopefully it will be useful.

It's also worth pointing out that the scripts I use to create these are public, hosted on the alfresco-ubuntu-qs project on Google Code.

You should be able to create your own Alfresco 4 AMIs by following these simple steps

  1. Start by running up a preconfigured Ubuntu or other Linux AMI - I use Eric Hammond's list for the latest versions. Pick the right one for your geography and size requirements, I use the most recent 32-bit instance-store AMI from the W Europe region

  2. While the instance is starting up, download the latest Quickstart scripts from Google Code

  3. Once the machine is started, check you can connect to it via SSH, using the keypair you specified when starting the image and the username 'ubuntu'

  4. Create a new directory named 'ec2' in your home directory on the running instance

  5. Use SCP or rsync to copy the quickstart scripts bundle, plus your AWS certificate and private key files (cert-blah.cert and cert-blah.pk) from your local machines. Place the script bundle in /home/ubuntu and the certificate and key files in the new /home/ubuntu/ec2 directory

  6. Back in your SSH session on the instance, extract the contents of the quickstart bundle and change into the new alfresco-ubuntu-qs directory

  7. Use the install.sh script to install Alfresco and its dependencies on the instance by typing sudo ./install.sh. For 4.0.a and 4.0.b, which do not support the DOD Records Management module, you will need to add the --no-install-dod option to the command.

  8. The script will run through and you will be prompted for a MySQL password. You must enter 'alfresco' unless you have changed the value of $MYSQL_USER in the script to something else.

  9. The script will indicate that it has finished installing Alfresco. Do not start Tomcat, since this will bootstrap the repository data, which you do not want to do before bundling.

  10. Change back into your home directory

  11. Create the AMI files using the sc2-bundle-vol command

    sudo ec2-bundle-vol -d /mnt -p alfresco-community-mysql-4.0.a-i386 -u  111111111111 -k ec2/pk-*.pem -c ec2/cert-*.pem -e  /home/ubuntu/ec2,/home/ubuntu/.ssh,/home/ubuntu/.cache,/home/ubuntu/.sudo_as_admin_successful,/home/ubuntu/.byobu,/home/ubuntu/alfresco-ubuntu-qs,/home/ubuntu/alfresco-ubuntu-qs-*.tar -s 4096

    You must set your numerical AWS account ID using the -u flag. Also you should review the list of excluded files to ensure that you are not bundling any files that you do not want to.

  12. Once the bundling process has finished, upload it to your S3 bucket using the ec2-upload-bundle command

    ec2-upload-bundle -b my-s3-bucket -m /mnt/alfresco-community-mysql-4.0.a-i386.manifest.xml -a aid -s secret --location EU

    You must specify your S3 bucket name using the -b option, and ensure that you set your AWS access key and AWS secret key using the -a and -s options

  13. Once the upload has completed, log into your AWS EC2 web console, navigate to the AMIs section and click the Register New AMI button to register your new image. Enter the path of the uploaded manifest file within the bundle you just uploaded, this will be something like 'my-s3-bucket/alfresco-community-mysql-4.0.a-i386.manifest.xml'

  14. Now your AMI is registered you can see if it works by creating a new instance of it. If it does, then you can safely shut down the originial Ubuntu instance as you will no longer need this.

  15. If you want others to be able to run your image then you will need to add the necessary permissions for this, using the web console.