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:

[code]apt-get install php5-pgsql postgresql[/code]

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

[code]
cd /usr/local/bin/
wget http://www.kevinmross.com/downloads/install_fusionpbx.sh
[/code]

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!:

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

The script starts off by checking your system:
[code]

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]?
[/code]

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.

[code]
now install FusionPBX. This should go fast.

Press Enter to continue (check for errors)
[/code]

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

[code]

Adding user `freeswitch’ to group `www-data’ …
Adding user freeswitch to group www-data
Done.
Adding user `www-data’ to group `daemon’ …
Adding user www-data to group daemon
Done.
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)

[/code]

…again…

[code]

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)
[/code]

…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.

[code]
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
[/code]

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

[code]
CREATE ROLE fusionpbx SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US
[/code]

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

The pgsql username is fusionpbx
The pgsql database name is fusionpbx
Please provide a password for the fusionpbx user
Password:
Let’s repeat that
Password:
psql: FATAL: database “fusionpbx” does not exist
overwriting pgsql password variable with random data
[/code]

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:

[code]
mkdir /usr/local/pgsql/
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su – postgres
[/code]

and to initialize…

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

after initializing it with a success message…

[code]

Success. You can now start the database server using:

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

[/code]

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

[code]
/usr/local/pgsql/bin/createdb fusionpbx
psql
[/code]

once in in postgres cli…
[code]
postgres=# ALTER USER fusionpbx with PASSWORD ‘YOUR_PASSWORD’;
\q
[/code]

and then…
[code]

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
http://192.168.1.101
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.
[/code]

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:
[code]

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

[/code]

[code]
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…
FIXED
Setting up Fail2Ban for FusionPBX
Restarting authentication failure monitor: fail2ban.
Installation Completed. Now configure FreeSWITCH via the FusionPBX browser interface

http://192.168.1.101
Default login is (whatever you picked in the GUI install):
User: WhateverUsernameYouPicked
Passwd: YourPasswordYouPicked
Checking to see if FreeSWITCH is running!
6471 Backgrounding.

[/code]

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

Pandora on Raspberry Pi

The raspberry pie makes a great pandora unit.  Duct tape it to the back of a battery-powered speaker with the 3.5 plug connected and it becomes a rocking portable boombox….make sure you have a long ethernet cord though!  Here’s how assuming root@:

We first want to push the audio out to the 3.5 jack:

[code]root@raspberrypi:~# amixer cset numid=3 1[/code]

then install pianobar:

[code]root@raspberrypi:~# apt-get install pianobar[/code]

Pianobar controls are located here.