Standing on the shoulders of giants..

As usual, the first port of call is Google - a couple of relevant posts stand out:

  • Setup Elastix Server on EC2 - this post presents a method of setting up Elastix locally on VirtualBox, and then uses dd to copy the image onto a mounted EBS device - followed by a number of steps to create an AMI.
  • Installing Elastix 2.3 on CentOS 5.8 VPS - this post presents a method for a traditional VPS environment - but crucially includes information on the final step of how to run the startup script to change admin and mysql passwords without direct console access.
  • Asterisk In A Cloud - quite old, but detailed information on setting up firewall rules - I haven't validated how much of this is still relevant.

The Plan

The first method looked a bit laborious, so I decided to see if i could use the second method to get Elastix up and running on EC2 - limited credit to me here, for the most part I am following through the steps from the second blog linked to above, with slight tweaks. Also note I am running commands as root - so prefix with sudo where relevant for your usage.

  1. Elastix 2.4 stable uses CentOS 5.9 - so find a Centos 5.9 based AMI (I used ami-a91e5dc0 which is a RightScale image - these are normally solid AMIs) - spin up an EC2 instance - the AMI i'm using is 64-bit so i started up a c3.large.
  2. Sidenote: The last time I installed Asterisk on EC2 I ran into an issue with the kernel timing - by default it was set to 100Hz, giving poor quality, 1000Hz is better. The way to check is to run the following:
    cat /boot/config-`uname -r` | grep HZ
    I think the issue was prevalent on Ubuntu images, i'm not sure if CentOS was affected, but on checking the CentOS image I am using here it appears fine (i.e. it's using 1000Hz).
  3. SSH into your new instance.
  4. Fetch the EPEL repository definitions from the Fedora Project
    Sidenote: the RightScale image I am using included some EPEL settings so I disabled them in favour of using the direct EPEL release - edit the file /etc/yum.repos.d/CentOS-Base.repo - find the [epel] section and change enabled to 0 and then find [rightscale-epel] and again set enabled to 0. Clear the yum cache with yum clean all
    rpm -ivh http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
  5. Update the box
    yum -y update
  6. Pull down the ISO image of Elastix - i'm using the latest stable 2.4 release and i'm using a 64-bit instance - (you can find the URL to download the ISO from the Elastix download page)
    wget <Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso>
  7. Mount the ISO locally
    mkdir /mnt/iso
    mount -o loop Elastix-2.4.0-Stable-x86_64-bin-04feb2013.iso /mnt/iso
    cd /mnt/iso
  8. Create a Yum repository file for the mounted ISO - gist here - and place into /etc/yum.repos.d/elastix-cd.repo
    wget https://gist.github.com/chris-at-thewebfellas/8086953/raw/dacd4440e110ec0dab6ad65495f0fb9a5ee302e1/elastix-cd.repo -O /etc/yum.repos.d/elastix-cd.repo
  9. Install Elastix
    yum -y install elastix
  10. Modify the elastix-cd.repo file you created earlier and set enabled to equal 0 (to disable it, as it won't be mounted when you reboot) - clear the yum cache with
    yum clean all
  11. Startup MySQL
    service mysqld start
  12. Run the Elastix startup script to setup your MySQL and Admin password
    /etc/rc3.d/S66elastix-firstboot start
  13. Reboot your instance
  14. SSH back in to the machine and update the system (you could probably do this before rebooting - or you could probably initiate this through the web interface)
    yum -y update
  15. Reboot your instance (i'm not convinced this is necessary, the only time you should need to reboot is for kernel changes, but I'm not familiar enough with Elastix so am doing a reboot to be safe)
  16. Make sure you have HTTP and HTTPS enabled in your Security Group and access your instance in a web browser.

Success!

Assuming you've followed everything above, and assuming it's all worked, you should now be able to login to the admin interface using the username 'admin' and the password you chose above. Beyond this, all that should be left is to setup necessary port access in your security group - i'm also not sure if there is any benefit to using an Elastic IP. Enjoy!