FreePBX: Difference between revisions

From Alpine Linux
(added to category telephony)
m (minor layout changes)
Line 8: Line 8:
* Freepbx 2.7.0
* Freepbx 2.7.0


== Lighttpd + PHP ==
== Install Lighttpd and PHP ==


Install lighttpd and PHP
{{:Setting Up Lighttpd With FastCGI}}


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


Enable PHP FastCGI in lighttpd by uncommenting fastcgi
{{Cmd|pear install DB}}
 
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 ==
== MySQL ==
Line 35: Line 20:
Install MySQL
Install MySQL


apk add mysql mysql-client
{{Cmd|apk add mysql mysql-client}}


Initiate databases
Initiate databases


/usr/bin/mysql_install_db --user=mysql
{{Cmd|/usr/bin/mysql_install_db --user=mysql}}


Start MySQL and add to system start
Start MySQL and add to system start


/etc/init.d/mysql start && rc-update add mysql default
{{Cmd|/etc/init.d/mysql start && rc-update add mysql default}}


Set MySQL root password
Set MySQL root password


/usr/bin/mysqladmin -u root password 'new-password'
{{Cmd|/usr/bin/mysqladmin -u root password 'new-password'}}


== Asterisk ==
== Asterisk ==
Line 53: Line 38:
Install asterisk (replace vserver with your kernel version).
Install asterisk (replace vserver with your kernel version).


apk add asterisk asterisk-sample-config dahdi-linux-vserver asterisk-addons-mysql
{{Cmd|apk add asterisk asterisk-sample-config dahdi-linux-vserver asterisk-addons-mysql}}


Start asterisk (do not add to system start)
Start asterisk (do not add to system start)


/etc/init.d/asterisk start
{{Cmd|/etc/init.d/asterisk start}}


== FreePBX ==
== FreePBX ==
Line 63: Line 48:
Download Freepbx
Download Freepbx


wget http://mirror.freepbx.org/freepbx-2.7.0.tar.gz
{{Cmd|wget http://mirror.freepbx.org/freepbx-2.7.0.tar.gz}}


Unpack source
Unpack source


tar zxvf freepbx-2.7.0.tar.gz && cd freepbx-2.7.0
{{Cmd|tar zxvf freepbx-2.7.0.tar.gz && cd freepbx-2.7.0}}


Add freepbx databases to MySQL
Add freepbx databases to MySQL


mysqladmin create asterisk -p
{{Cmd|mysqladmin create asterisk -p
mysqladmin create asteriskcdrdb -p
mysqladmin create asteriskcdrdb -p}}


Import SQL data into MySQL
Import SQL data into MySQL


mysql -D asterisk -u root -p < SQL/newinstall.sql
{{Cmd|mysql -D asterisk -u root -p < SQL/newinstall.sql
mysql -D asteriskcdrdb -u root -p < SQL/cdr_mysql_table.sql
mysql -D asteriskcdrdb -u root -p < SQL/cdr_mysql_table.sql}}


Open connection to MySQL
Open connection to MySQL


mysql -u root -p
{{Cmd|mysql -u root -p}}


Create MySQL users
Create MySQL users


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


Close connection
Close connection


exit
{{Cmd|exit}}


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)
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
{{Cmd|apk add sed patch}}


Flash operator panel needs Perl
Flash operator panel needs Perl


apk add perl
{{Cmd|apk add perl}}


Start the installer (you can accept the defaults)
Start the installer (you can accept the defaults)


./install_amp
{{Cmd|./install_amp}}


== Finishing up ==
== Finishing up ==
Line 108: Line 93:
Change user/group of lighttpd to asterisk
Change user/group of lighttpd to asterisk


vim +50 /etc/lighttpd/lighttpd.conf
{{Cmd|vim +50 /etc/lighttpd/lighttpd.conf}}


Change permissions of lighttpd/freepbx files
Change permissions of lighttpd/freepbx files


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


Stop asterisk
Stop asterisk


/etc/init.d/asterisk stop
{{Cmd|/etc/init.d/asterisk stop}}


Patch FreePBX to support Alpine Linux
Patch FreePBX to support Alpine Linux
[[File:Freepbx_engine.patch.txt]]
[[File:Freepbx_engine.patch.txt]]


cd /var/lib/asterisk/bin
{{Cmd|cd /var/lib/asterisk/bin
patch -p0 < freepbx_engine.patch
patch -p0 < freepbx_engine.patch}}


This file gets overwritten when using freepbx so we need to patch the original
This file gets overwritten when using freepbx so we need to patch the original
[[File:Freepbx_engine.patch.txt]]
[[File:Freepbx_engine.patch.txt]]


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


Start Asterisk with FreePBX
Start Asterisk with FreePBX


amportal start
{{Cmd|amportal start}}


Load needed dahdi modules
Load needed dahdi modules


modprobe dahdi
{{Cmd|modprobe dahdi
modprobe dahdi_dummy
modprobe dahdi_dummy}}


Make them load on boot
Make them load on boot


echo dahdi >> /etc/modules
{{Cmd|echo dahdi >> /etc/modules
echo dahdi_dummy >> /etc/modules
echo dahdi_dummy >> /etc/modules}}
 
 
EOF

Revision as of 06:19, 23 June 2011

Set up Freepbx on Alpine Linux

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

Install Lighttpd and PHP

Basic Installation

For installing the additional packages first activate community packages and update the package index

Install the required packages:

# apk add lighttpd php82 fcgi php82-cgi

Configure Lighttpd

Edit lighttpd.conf (/etc/lighttpd/lighttpd.conf) and uncomment the line:

Contents of /etc/lighttpd/lighttpd.conf

... include "mod_fastcgi.conf" ...

Edit mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf), find and change /usr/bin/php-cgi to /usr/bin/php-cgi82.

Contents of /etc/lighttpd/mod_fastcgi.conf

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

Start lighttpd service and add it to default runlevel

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

Install pear DB

pear install DB

MySQL

Install MySQL

apk add mysql mysql-client

Initiate databases

{{{1}}}

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, 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)

./install_amp

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 hown -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