FreePBX: Difference between revisions
Clandmeter (talk | contribs) |
(replace /etc/init.d with rc-service) |
||
(22 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
{{Obsolete|The FreePBX version on this page is EOL for nearly a decade, please update it to FreePBX 13 or 14}} | |||
This document will be a quick c/p guide to setup asterisk with freepbx on Alpine | This document will be a quick c/p guide to setup asterisk with [https://www.freepbx.org/ FreepPBX] on Alpine Linux. What we will setup is the following: | ||
* Lighttpd with PHP using FastCGI | * Lighttpd with PHP using FastCGI | ||
Line 7: | Line 7: | ||
* Freepbx 2.7.0 | * Freepbx 2.7.0 | ||
== Lighttpd | == Install Lighttpd and PHP == | ||
{{:Setting Up Lighttpd With FastCGI}} | |||
== Install pear DB == | |||
{{Cmd|apk add php7-pear; pear install DB}} | |||
== MySQL == | == MySQL == | ||
Follow [[MariaDB|MariaDB installation and configuration guide]] to prevent errors during installation. Below is an example of necessary steps, but it won't work before you do following article. | |||
{{Cmd|apk add mysql mysql-client}} | |||
Initiate databases | Initiate databases | ||
{{Cmd|<nowiki>/usr/bin/mysql_install_db --user=mysql</nowiki>}} | |||
Start MySQL and add to system start | Start MySQL and add to system start | ||
{{Cmd|rc-service mariadb start && rc-update add mariadb default}} | |||
Set MySQL root password | Set MySQL root password | ||
{{Cmd|/usr/bin/mysqladmin -u root password 'new-password'}} | |||
== Asterisk == | == Asterisk == | ||
Line 52: | Line 37: | ||
Install asterisk (replace vserver with your kernel version). | Install asterisk (replace vserver with your kernel version). | ||
{{Cmd|apk add asterisk asterisk-sample-config asterisk-dahdi asterisk-cdr-mysql}} | |||
Start asterisk (do not add to system start) | Start asterisk (do not add to system start) | ||
{{Cmd|rc-service asterisk start}} | |||
== FreePBX == | == FreePBX == | ||
Line 62: | Line 47: | ||
Download Freepbx | Download Freepbx | ||
{{Cmd|wget <nowiki>https://mirror.freepbx.org/freepbx-2.7.0.tar.gz</nowiki>} | |||
Unpack source | Unpack source | ||
{{Cmd|tar zxvf freepbx-2.7.0.tar.gz && cd freepbx-2.7.0}} | |||
Add freepbx databases to MySQL | Add freepbx databases to MySQL | ||
{{Cmd|mysqladmin create asterisk -p | |||
mysqladmin create asteriskcdrdb -p}} | |||
Import SQL data into MySQL | Import SQL data into MySQL | ||
{{Cmd|mysql -D asterisk -u root -p < SQL/newinstall.sql | |||
mysql -D asteriskcdrdb -u root -p < SQL/cdr_mysql_table.sql}} | |||
Open connection to MySQL | Open connection to MySQL | ||
{{Cmd|mysql -u root -p}} | |||
Create MySQL users | Create MySQL users | ||
{{Cmd|GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; | |||
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';}} | |||
Close connection | Close connection | ||
{{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) | ||
{{Cmd|apk add sed patch}} | |||
Flash operator panel needs Perl | Flash operator panel needs Perl | ||
{{Cmd|apk add perl}} | |||
Start the installer (you can accept the defaults) | Start the installer (you can accept the defaults) | ||
{{Cmd|./install_amp}} | |||
== Finishing up == | == Finishing up == | ||
Line 107: | Line 92: | ||
Change user/group of lighttpd to asterisk | Change user/group of lighttpd to asterisk | ||
{{Cmd|vim +50 /etc/lighttpd/lighttpd.conf}} | |||
Change permissions of lighttpd/freepbx files | Change permissions of lighttpd/freepbx files | ||
{{Cmd|rc-service 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 | |||
rc-service lighttpd start}} | |||
Stop asterisk | Stop asterisk | ||
{{Cmd|rc-service asterisk stop}} | |||
Patch FreePBX to support | Patch FreePBX to support Alpine Linux | ||
[[File:Freepbx_engine.patch.txt]] | [[File:Freepbx_engine.patch.txt]] | ||
{{Cmd|cd /var/lib/asterisk/bin | |||
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]] | ||
{{Cmd|cd /var/www/localhost/htdocs/freepbx/admin/modules/framework/bin/ | |||
patch -p0 freepbx_engine.patch}} | |||
Start Asterisk with FreePBX | Start Asterisk with FreePBX | ||
{{Cmd|amportal start}} | |||
Load needed dahdi modules | Load needed dahdi modules | ||
{{Cmd|modprobe dahdi | |||
modprobe dahdi_dummy}} | |||
Make them load on boot | Make them load on boot | ||
{{Cmd|echo dahdi >> /etc/modules | |||
echo dahdi_dummy >> /etc/modules}} | |||
[[Category:Telephony]] | |||
[[Category:Server]] | |||
[[Category:PHP]] | |||
[[Category:SQL]] |
Latest revision as of 09:46, 17 November 2023
This material is obsolete ... The FreePBX version on this page is EOL for nearly a decade, please update it to FreePBX 13 or 14 (Discuss) |
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
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
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
Start lighttpd
service and add it to default runlevel
# rc-service lighttpd start # rc-update add lighttpd default
Install pear DB
apk add php7-pear; pear install DB
MySQL
Follow MariaDB installation and configuration guide to prevent errors during installation. Below is an example of necessary steps, but it won't work before you do following article.
apk add mysql mysql-client
Initiate databases
/usr/bin/mysql_install_db --user=mysql
Start MySQL and add to system start
rc-service mariadb start && rc-update add mariadb 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 asterisk-dahdi asterisk-cdr-mysql
Start asterisk (do not add to system start)
rc-service asterisk start
FreePBX
Download Freepbx
{{Cmd|wget https://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
rc-service 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 rc-service lighttpd start
Stop asterisk
rc-service 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