FreePBX

来自 阿尔派 Linux
此材料已过时...

此页面上的 FreePBX 版本已过时近十年,请更新到 FreePBX 13 或 14 (讨论)

本文档将是一个快速的 c/p 指南,用于在阿尔派 Linux 上设置带有 FreepPBX 的 asterisk。我们将设置以下内容

  • 使用 FastCGI 的 Lighttpd 和 PHP
  • MySQL 服务器
  • Freepbx 2.7.0

安装 Lighttpd 和 PHP

基本安装

为了安装额外的软件包,首先激活社区软件包并更新软件包索引

安装所需的软件包

# apk add lighttpd php82 fcgi php82-cgi

配置 Lighttpd

编辑 lighttpd.conf (/etc/lighttpd/lighttpd.conf) 并取消注释该行

/etc/lighttpd/lighttpd.conf 的内容

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

编辑 mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf),找到并将 /usr/bin/php-cgi 更改为 /usr/bin/php-cgi82

/etc/lighttpd/mod_fastcgi.conf 的内容

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

启动 lighttpd 服务并将其添加到默认运行级别

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

安装 pear DB

apk add php7-pear; pear install DB

MySQL

按照 MariaDB 安装和配置指南 以防止安装期间出错。以下是必要步骤的示例,但在您完成以下文章之前,它将无法工作。

apk add mysql mysql-client

初始化数据库

/usr/bin/mysql_install_db --user=mysql

启动 MySQL 并添加到系统启动

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

设置 MySQL root 密码

/usr/bin/mysqladmin -u root password '新密码'

Asterisk

安装 asterisk (将 vserver 替换为您的内核版本)。

apk add asterisk asterisk-sample-config asterisk-dahdi asterisk-cdr-mysql

启动 asterisk (不要添加到系统启动)

rc-service asterisk start

FreePBX

下载 Freepbx

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

解压源代码

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

将 freepbx 数据库添加到 MySQL

mysqladmin create asterisk -p mysqladmin create asteriskcdrdb -p

将 SQL 数据导入到 MySQL

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

打开到 MySQL 的连接

mysql -u root -p

创建 MySQL 用户

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

关闭连接

exit

Freepbx 安装程序不喜欢 busybox sed,所以我们添加了正常的 sed,我们需要稍后修补 2 个文件,所以我们需要 patch (之后您可以删除它们)

apk add sed patch

Flash operator panel 需要 Perl

apk add perl

启动安装程序 (您可以接受默认值)

./install_amp

完成

将 lighttpd 的用户/组更改为 asterisk

vim +50 /etc/lighttpd/lighttpd.conf

更改 lighttpd/freepbx 文件的权限

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

停止 asterisk

rc-service asterisk stop

修补 FreePBX 以支持阿尔派 Linux File:Freepbx engine.patch.txt

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

使用 freepbx 时,此文件将被覆盖,因此我们需要修补原始文件 File:Freepbx engine.patch.txt

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

使用 FreePBX 启动 Asterisk

amportal start

加载所需的 dahdi 模块

modprobe dahdi modprobe dahdi_dummy

使它们在启动时加载

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