Freepbx on asterisk

From Alpine Linux

Set up Freepbx on AlpineLinux

This document will be a quick c/p guide to setup asterisk with freepbx on Alpine linux. What we will setup is the following:

  • Lighttpd with PHP using FastCGI
  • MySQL server
  • Freepbx 2.7.0

Lighttpd + PHP

Install lighttpd and PHP

apk add lighttpd php php-gd php-cli php-curl php-xml php-mysql php-posix php-mcrypt php-gettext php-pear

Enable PHP FastCGI in lighttpd by uncommenting fastcgi

vim +46 /etc/lighttpd/lighttpd.conf

Start and add it to system start

/etc/init.d/lighttpd start && rc-update add lighttpd default

Create a test php file to see if your php installation is working and has all needed modules. Visit http://my-ip-address/phpinfo.php (you can delete the phpinfo.php file afterwards if you like)

echo "<?php phpinfo(); ?>" > /var/www/localhost/htdocs/phpinfo.php

Install pear DB

pear install DB

MySQL

Install MySQL

apk add mysql mysql-client

Initiate databases

/usr/bin/mysql_install_db --user=mysql

Start MySQL and add to system start

/etc/init.d/mysql start && rc-update add mysql default

Set MySQL root password

/usr/bin/mysqladmin -u root password 'new-password'

Asterisk

Install asterisk (replace vserver with your kernel version).

apk add asterisk asterisk-sample-config dahdi-linux-vserver asterisk-addons-mysql

Start asterisk (do not add to system start)

/etc/init.d/asterisk start

FreePBX

Download Freepbx

wget http://mirror.freepbx.org/freepbx-2.7.0.tar.gz

Unpack source

tar zxvf freepbx-2.7.0.tar.gz && cd freepbx-2.7.0

Add freepbx databases to MySQL

mysqladmin create asterisk -p
mysqladmin create asteriskcdrdb -p

Import SQL data into MySQL

mysql -D asterisk -u root -p < SQL/newinstall.sql
mysql -D asteriskcdrdb -u root -p < SQL/cdr_mysql_table.sql

Open connection to MySQL

mysql -u root -p

Create MySQL users

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

Close connection

exit

Freepbx installer does not like busybox sed so we add normal sed (you can remove it afterwards)

apk add sed

Flash operator panel needs Perl

apk add perl

Start the installer

./install_amp