Difference between revisions of "FreePBX"

From Alpine Linux
Jump to: navigation, search
(php5-pear doesn't exist)
Line 15: Line 15:
== MySQL ==
== MySQL ==
Install MySQL
Follow [[MariaDB|Install MySQL]] to prevent errors during installation.
{{Cmd|apk add mysql mysql-client}}
{{Cmd|apk add mysql mysql-client}}

Revision as of 19:35, 6 April 2021

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

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

Install Lighttpd and PHP

For installing the additional packages first activate community packages:

vi /etc/apk/repositories

Uncomment the following:


Update the packagelist:

apk update

Install the additional packages:

apk add lighttpd php7-common php7-session php7-iconv php7-json php7-gd php7-curl php7-xml php7-mysqli php7-imap php7-cgi fcgi php7-pdo php7-pdo_mysql php7-soap php7-xmlrpc php7-posix php7-mcrypt php7-gettext php7-ldap php7-ctype php7-dom php7-simplexml

Configure Lighttpd

Edit lighttpd.conf

vi /etc/lighttpd/lighttpd.conf

Uncomment line:

include "mod_fastcgi.conf"

Start lighttpd service and add to needed runlevel

rc-service lighttpd start && rc-update add lighttpd default

Install pear DB

apk add php7-pear; pear install DB


Follow Install MySQL to prevent errors during installation.

apk add mysql mysql-client

Initiate databases

/usr/bin/mysql_install_db --user=mysql

Start MySQL and add to system start

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

Set MySQL root password

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


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


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


Freepbx installer does not like busybox sed so we add normal sed, we need to patch 2 files later on so we need patch (you can remove them afterwards)

apk add sed patch

Flash operator panel needs Perl

apk add perl

Start the installer (you can accept the defaults)


Finishing up

Change user/group of lighttpd to asterisk

vim +50 /etc/lighttpd/lighttpd.conf

Change permissions of lighttpd/freepbx files

/etc/init.d/lighttpd stop chown -R asterisk:asterisk /var/log/lighttpd chown -R asterisk:asterisk /var/run/lighttpd* chown -R asterisk:asterisk /var/www/localhost/htdocs/freepbx /etc/init.d/lighttpd start

Stop asterisk

/etc/init.d/asterisk stop

Patch FreePBX to support Alpine Linux File:Freepbx engine.patch.txt

cd /var/lib/asterisk/bin patch -p0 < freepbx_engine.patch

This file gets overwritten when using freepbx so we need to patch the original File:Freepbx engine.patch.txt

cd /var/www/localhost/htdocs/freepbx/admin/modules/framework/bin/ patch -p0 freepbx_engine.patch

Start Asterisk with FreePBX

amportal start

Load needed dahdi modules

modprobe dahdi modprobe dahdi_dummy

Make them load on boot

echo dahdi >> /etc/modules echo dahdi_dummy >> /etc/modules