PBX In a Flash on Rackspace Cloud

asterisk pbxinaflash rscloud rackspace-cloud piaf

Sun May 16 19:57:37 -0700 2010

So, a little bit of introduction.

A project I am working on requires an asterisk server. In the hobbyist world, this usually means setting up a virtual machine or a beige box with one of several custom linux distributions that claim to do most of the heavy lifting for you.

And they do, but they only work if you can put a CD into the drive. Hence the beige box or the VMware Appliance.

But the guy paying for this wants the server in the cloud, which is totally cool with me. “Sure,” I told him, ”I’m sure someone else has tried to put one of these distributions in the cloud before.” I’d perform a few searches, copy some code, and call it done.

Unfortunately, even my most powerful google-fu returned nothing of value. Every post I found started with someone asking how to do what I was trying to do, and trailed off with people saying they were going to dive in and publish their results. Six months later, the thread is dead, and still no results. Did they get it working? Did they give up? Were their hands replaced with claws, rendering them unable to type? I shudder to think.

But I am here to fill in for them. They can go back to cowering in the corners with their lobster hands. We don’t need them.

I totally got PBX In a Flash on a Rackspace Cloud Server, and it wasn’t even that hard.

I am about to tell you how I set up my asterisk server, on the Rackspace Cloud, from my phone, which has an SSH client. Yes, my phone.


The process can basically be broken down into only four steps:

  1. Start up a CentOS instance
  2. Get the PIAF iso onto your cloud server
  3. Install the prerequisites
  4. Run the PIAF installer

By far, the hardest step is number three, for a few reasons, but mostly because it’s number three. It’s like a sideways smirk or something. Look at it there. It’s a horrible, smug little cat. :3

Let’s tackle those steps one at a time.

Starting up your Rackspace Cloud Instance

Look, you’re a smart guy. I know that you know how to do this. The most important aspect of this step is that it be based on the CentOS 5.x image. You can use 5.4 or 5.5, I really don’t think it will matter too much. At the time of this writing, CentOS 5.4 makes up the basis for PIAF, so maybe you should go with that. All set? Okay, then we’re on to…

Get the PIAF iso onto your cloud server

Use wget. Name the file something like piaf.iso or something you can remember. Next step.

Install the Prerequisites

Okay. Remember I told you that this step was the hardest? That’s because it’s actually a bunch of little steps. I’m not going to tell you them all up front, though, because that’s just too easy.

First, we need to mount the iso that we just downloaded because it contains some of the packages we need and also because it has a little file that lists out the packages that we need before we go any further. So do the following:

pbx# mkdir -p /media/cdrom
pbx# mount -o loop ~/piaf.iso /media/cdrom

Perfect. Now go to your /media directory and set up a yum repository for that disk.

pbx# cd /media
pbx# yum install createrepo
pbx# createrepo .

That was pretty easy, right? Now we need to configure yum so it knows to look into our repository. do that like so:

pbx# cat > /etc/yum.repos.d/piaf.repo
[PBX-In-A-Flash]
name=PBX In a Flash ISO
baseurl=file:///media/
gpgcheck=0
enabled=1
^D

pbx# yum clean all

And now we need to actually get down to the business of actually installing all of those prerequisites. To get a listing of them, go ahead and look in the kickstart file for whatever version you are installing. There are a number of prerequisites that probably aren’t even remotely needed, but I will leave that to you to figure out. I opted to install PIAF version 1.6, so my file was called ks16.cfg, but you can do it with ks.cfg if you like. And you can install the whole list by hand, or you can use a couple of loops, like I did.

pbx# cd /media/cdrom
pbx# cat ks16.cfg | egrep '^@' | xargs yum groupinstall -x*.i386 -y
...
...

A few of things to note at this step. First, the packages you will need to install are in the %packages section. Second, the packages that start with @ are actually groups of packages. Third, I noticed some conflicts if I didn’t make sure to exclude all of the i386 versions of the packages it was installing (I was installing on an x86_64 system). Last, some of the packages it asks to install, like a desktop environment, probably aren’t remotely necessary. I skipped some of the packages and groups listed, and it doesn’t seem to have broken anything.

Oh, yeah. And when it’s all done, you are going to need to

pbx# reboot

Run the PIAF installer

This step is probably the easiest, but first you need to make sure you do one little thing to make sure your mysql database is working perfectly at the end. Run this

echo "127.0.0.1  pbx.local" >> /etc/hosts

which tricks the PIAF installer into believing that it is properly in install mode. Just kidding! Part of the install process involves connecting to the local mysql server to change passwords, but for some reason the installer trys to connect to pbx.local instead of 127.0.0.1. Strange stuff. Anyway, this should fix it.

Next, we want to fire up the actual installer

pbx# yum install piafdl
pbx# piafdl 16

Where 16 refers to 1.6. If you want to install 1.4, you would do piafdl 14. Get it? This will bring up a dialog, you should push A, which is what it tells you anyway, it does its big scary process, reboots, and BAM, you should be all set up.

blog comments powered by Disqus