FreePBX up and running!

The good news: it works! And actually, it works very well! After having set up the latest FreePBX 2.10.0 + Asterisk successfully, everything is running very smoothly on my Raspberry Pi here. I was a bit afraid the Raspberry would not have enough CPU/RAM resources to power FreePBX + Asterisk, but it does. And it runs quite well, the web GUI is responsive enough to work completely normal. And I did not even use a lightweight webserver, just the regular Apache2 / PHP5.3 / Mysql 5.1.

After FreePBX was finally installed I set up 2 extensions to connect my Android phone with Sipdroid and an old FritzBox used as ATA. Test calls between both phones on my local network had perfect quality, and during the call the CPU usage of the asterisk stayed below 5%. It looks like the Raspberry could handle a few calls from a small office easily. However, I have not yet installed the FOP and also did not try transcoding / conferences or other stuff yet.

After my own install was complete I read Mo’s blog here, he has been using FreePBX 2.9. I have tried the new 2.10 version with the latest GUI myself and document my own install procedure below. During the install I encountered a few glitches and had to fix several things myself. It looks like the 2.10 installer has some issues, at least it did not work out of the box for me.

Make sure to have a 4GB card at least with the root partition expanded (using gparted should be the easiest way).

First install Asterisk as documented in the previous post. Then:

apt-get install -y apache2 php5 php5-cli mysql-server-5.1 php-pear php5-mysql php-db libapache2-mod-php5 php5-gd php5-curl
adduser asterisk --disabled-password --gecos "asterisk PBX" --home /var/lib/asterisk
adduser www-data asterisk

Set the mysql root password during it’s installer.  Then edit /etc/apache2/envvars and set user and group to “asterisk”. I had to do this here instead of in /etc/apache2/apache.conf

Then create the databases (requires mysql root pw):

mysql -u root -p

on the mysql prompt, enter:

create database asteriskcdrdb;
create database asterisk;
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
quit

Then:

cd /usr/src
wget http://mirror.freepbx.org/freepbx-2.10.0.tar.gz
tar -xvzf freepbx-2.10.0.tar.gz
cd freepbx-2.10.0
mysql -u asteriskuser -pamp109 asteriskcdrdb < /usr/src/freepbx-2.10.0/SQL/cdr_mysql_table.sql
mysql -u asteriskuser -pamp109 asterisk < /usr/src/freepbx-2.10.0/SQL/newinstall.sql
chown -R asterisk:asterisk /var/run/asterisk

Then:

/usr/src/freepbx-2.10.0/install_amp
/usr/src/freepbx-2.10.0/apply_conf.sh

I tried to set the webroot to /var/www but this failed completely. No way to get this working in reasonable time. So I kept the default /var/www/html and instead edited /etc/apache2/sites-available/default

       DocumentRoot /var/www/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

Then of course call /etc/init.d/apache2 restart. I also needed to fix /etc/asterisk/manager.conf

replace

[AMPMGRUSER]
secret = AMPMGRPASS

with

[admin]
secret = amp111

Then

amportal stop
amportal start
sudo -u asterisk /var/lib/asterisk/bin/module_admin upgradeall
sudo -u asterisk /var/lib/asterisk/bin/module_admin reload

On top I was missing some symbolic links I believe the installer should have created for me, but somehow I needed this to make it work:

cd /etc/asterisk
rm extensions.conf
ln -s /var/www/html/admin/modules/core/etc/extensions.conf extensions.conf
rm features.conf
ln -s /var/www/html/admin/modules/core/etc/features.conf features.conf
rm iax.conf
ln -s /var/www/html/admin/modules/core/etc/iax.conf iax.conf
rm logger.conf
ln -s /var/www/html/admin/modules/core/etc/logger.conf logger.conf
rm sip.conf
ln -s /var/www/html/admin/modules/core/etc/sip.conf sip.conf
rm sip_notify.conf
ln -s /var/www/html/admin/modules/core/etc/sip_notify.conf sip_notify.conf

At this point I was able to log into FreePBX, then enabled all modules in the module admin. Somehow I was unable to reload the configuration so I had to disable the modules “Custom Applications” and “Recordings” again, because they had missing mysql tables. Also not sure yet where to get these from.

Enjoy…

7 thoughts on “FreePBX up and running!

  1. how about using sqlite on that small raspberry pi instead of a full blown mysql server? 🙂

    • Thanks for the hint, I will test this some day. I just wanted to make sure it really works before trying other things.

  2. >had missing mysql tables. Also not sure yet where to get these from.

    Fire up a VM installation (eg: VirtualBox); see if you can export as .sql & import onto your distro.

    • Don’t worry, I will provide an image. I just want to install the FOP as well and fix a few remaining issues.

        • Ok thanks for this hint. Today I’ve tried to install the original FOP but without success. I tried around for some time then gave up. Probably this works somehow, just need to find out. The new FOP2 is a binary package anyway and not yet available for the ARM platform.