We build Web & Mobile Applications.

< All Articles

Install Elastix on Amazon EC2

We recently received an enquiry asking us if we could help install Elastix onto an Amazon EC2 instance. It’s been a couple of years since I last installed Asterisk onto EC2, so I couldn’t help but give Elastix a try.

Standing on the shoulders of giants..

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

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.

    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).2. SSH into your new instance.

  2. SSH into your new instance.

  3. 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
    
  4. Update the box

    yum -y update
    
  5. 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
    
  6. 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
    
  7. 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/chrisanderton/8086953/raw/dacd4440e110ec0dab6ad65495f0fb9a5ee302e1/elastix-cd.repo -O /etc/yum.repos.d/elastix-cd.repo
    
  8. Install Elastix

    yum -y install elastix
    
  9. 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
    
  10. Startup MySQL

    service mysqld start
    
  11. Run the Elastix startup script to setup your MySQL and Admin password/etc/rc3.d/S66elastix-firstboot start

  12. Reboot your instance

  13. 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
    
  14. 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)

  15. 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!

Updated on 07 February 2019
First published by Chris Anderton on 22 December 2013
© Chris Anderton 2019
"Install Elastix on Amazon EC2" by Chris Anderton at TheWebFellas is licensed under a Creative Commons Attribution 4.0 International License.