Install FusionPBX on Raspberry Pi

Well, I couldn’t stop with JUST installing FreeSWITCH, so I took it a step further and installed FusionPBX which is the UI.  I had to do a tidbit of editing to their install script, and hack some workarounds, but I got it working successfully.

With the assumption that FreeSwitch is installed using my tutorial here, you’re halfway home to getting FusionPBX installed.  Note: rolled in sudo -s (root)

Prior to installing, I downloaded a couple packages that I assumed I needed:

apt-get install php5-pgsql postgresql

I placed the edited installed script here, so you probably will want to wget it:

cd /usr/local/bin/

Now, the install script is pretty horridly edited and I really did not take any time with it nor brushed it over with a ‘fine-tooth-comb‘ to optimize, so it will install a bunch of possibly useless packages, but its really no big deal for ‘proof of concept’ right?

After you download it, its time to make it executable and then run it!:

chmod 755 /usr/local/bin/install_fusionpbx/
/usr/local/bin/ install-both user |tee /tmp/install_fusion.log

The script starts off by checking your system:

Good, you are root.
Internet connection is working, continuing!
This script was written for Ubuntu 10.04 LTS codename Lucid

Your OS appears to be:
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing/unstable
Release: testing/unstable
Codename: n/a
Do you want to continue [y|n]?

Obviously we want to continue, so we say “y”.

The script will go through a ton of packages and checks, and assuming there is no issues, we can move onto the next step.

now install FusionPBX. This should go fast.

Press Enter to continue (check for errors)

…and obviously we press enter again if there were no errors…

Adding user `freeswitch' to group `www-data' ...
Adding user freeswitch to group www-data
Adding user `www-data' to group `daemon' ...
Adding user www-data to group daemon
freeswitch is now a member of the www-data group
www-data is now a member of the dameon group

Press Enter to continue (check for errors)


FusionPBX install needs Write permissions on group to remove files
The daemon group (of which www-data is a member) can now edit all files
in your FreeSWITCH installation. This may or may not be desirable

if you want to change this, run (as root)
/usr/bin/find /usr/local/freeswitch -type f -exec /bin/chmod g-w {} \;
/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod g-w {} \;
however; FusionPBX won't be able to make changes anymore
renaming default FreeSWITCH extensions .noload
Press Enter to continue (check for errors)

…and yet again…

The next step is for a database setup.  I am extremely familiar with Postgres so that will be my database of choice.

Now for a database...

New Option...
SQlite is already installed (and required)

Would you like to install MySQL, PostgreSQL or stay with Sqlite (m/p/S)? p
precise is PostgreSQL 9.1 by default
Installing PostgeSQL version 9.1

during the install of Postgres, I noticed that the script threw an error where the database did not create successfully:

createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US

At some point I was prompted to enter a password which failed miserably:

The pgsql username is fusionpbx
The pgsql database name is fusionpbx
Please provide a password for the fusionpbx user
Let's repeat that
psql: FATAL: database "fusionpbx" does not exist
overwriting pgsql password variable with random data

So I just logged into a new ssh session (if you are using screen, you can just detatch), and noticed there was no data folder for the install and the db had not been init.  So I just did it manually:

mkdir /usr/local/pgsql/
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres

and to initialize…

/usr/lib/postgresql/9.1/bin/initdb -D /usr/local/pgsql/data

after initializing it with a success message…

Success. You can now start the database server using:

/usr/lib/postgresql/9.1/bin/postgres -D /usr/local/pgsql/data
/usr/lib/postgresql/9.1/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

I started up postgres and created the database manually, set user, pass, role, etc.

/usr/local/pgsql/bin/createdb fusionpbx

once in in postgres cli…

postgres=# ALTER USER fusionpbx with PASSWORD 'YOUR_PASSWORD';

and then…

Now you'll need to manually finish the install and come back
This way I can finish up the last bit of permissions issues
Just go to
MAKE SURE YOU CHOOSE PostgreSQL as your Database on the first page!!!
ON the Second Page:
Database Name: fusionpbx
Database Username: fusionpbx
Database Password: whateveryouentered
Database Username: Leave_Blank (remove pgsql)
Create Database Password: Leave_Blank

I will wait here until you get done with that.
When PostgreSQL is configured come back and press enter.

I then went in and entered the database db type, db name, login, password, etc into the webUI.  It will take a bit of time to install, but once it is, go back to the CLI and finish the installation there:

I will wait here until you get done with that.
When PostgreSQL is configured come back and press enter.

The FusionPBX installation changed permissions of /usr/local/freeswitch/storage
Waiting on you to finish installation (via browser), I'll clean up
the last bit of permissions when you finish.Waiting on /var/www/fusionpbx/includes/config.php

/var/www/fusionpbx/includes/config.php Found!
Waiting 5 more seconds to be sure.
..... Fixing...
Setting up Fail2Ban for FusionPBX
Restarting authentication failure monitor: fail2ban.
Installation Completed. Now configure FreeSWITCH via the FusionPBX browser interface
Default login is (whatever you picked in the GUI install):
User: WhateverUsernameYouPicked
Passwd: YourPasswordYouPicked
Checking to see if FreeSWITCH is running!
6471 Backgrounding.

And thats it folks.  That is a quick and hacked up way to install freePBX on the raspi:

FreeSWITCH on the Raspberry Pi

The $35 mean machine really comes out on top for slapping together a PBX very quickly.  Before I started this project, I saw Asterisk being ported over onto the Raspberry Pi, so I decided to take a shot at it a couple months back just before ClueCon for FreeSWITCH.  Here were the results:

You initially want to start out with a Raspian image (I used Wheezy):

DD the image onto your SD-card.  You can use the wiki located here for instructions on how to do it.

Be sure to go through the install process using raspi-config.  You will want to expand the partition, etc.

And now we begin…

I like to roll around as root so as soon as I logged in as the default ‘pi’ user, I immediately dropped into a sudo shell as root.

sudo -s

I immediately installed several other pieces of software/libraries I like to have for this build as well as for my own future use:

apt-get update
apt-get install screen default-jre mlocate autoconf automake libtool libncurses5-dev libjpeg8-dev default-jre git libperl-dev libdb-dev libiksemel-dev gnutls-bin libgnutls-dev

While we are at it here, lets link up a couple libraries:

ln -s /usr/lib/arm-linux-gnueabihf/ /usr/lib/
ln -s /usr/lib/arm-linux-gnueabihf/ /usr/lib/

The first thing to do here is to clone the git repo on the unit, but we have to change directories to:

cd /usr/local/src

For a stable release:

git clone -b v1.2.stable git://

or if you want the latest and greatest

git clone git://

From here we will change directories into the FreeSWITCH dir.

cd freeswitch

We then will want to run the boostrap to make the modules.conf file for us to edit


You can now edit the modules.conf if you want to add any additional modules by uncommenting them out.  (For my build, I uncommented mod_dingaling which gives support for Google Voice)

Once that step is done, lets configure:


After configure was done, I edited the makefile to remove the second instance of “-Werror” which is a flag that stops the build process on a warning.  Info: Not doing this will stop the build, so if you hate yourself and want to waste hours of RasPi CPU time, feel free to do this continuously.

vi makefile

just an FYI: if you get angry with the arrow keys in vi, you can

:set term=cons25

…which should make you happy again.

I went ahead and removed the second instance of “Werror” within the make file because I was getting possible irrelevant warnings that were stopping the compile process.  This is a cheap way around and probably isn’t recommended as it could create segfaults within FreeSWITCH…but I did it anyways. (This is proof of concept…what do you expect here?)

Once we are gucci, we can continue with make:


and then we shall install that puppy

make all install cd-sounds-install cd-moh-install

After many relentless hours of compiling; if there were no errors,  you have successfully built FreeSWITCH.  Lets run it!


Alternatively, you could add some tricks to it like chowning the FS directory so it doesn’t run under root, but this was a quickie proof of concept to show that it is possible to run FS under the RasPI.

My close friend Intralanman over at FSS gave me the glorious idea of using distcc with the Pi to help speed along the process.  I may toss up notes or a new article including it.

If you feel like going back to raspian but want to save you current image, you can always dd it off using either your linux or mac box.  I usually dd and compress at the same time to save space.  It will compress nicely too:

dd if=/dev/disk2 | gzip > {image_destination}/freeswitch_image.dd.gz