备受瞩目的Asterisk-16 已经发布,同时FreePBX在圣诞节前也支持了Debian-9 操作系统。我们为大家介绍一下如何在Debian-9 环境下安装FreePBX-15。支持阿里云和本地安装方式。安装FreePBX-15 需要经过以下几个步骤:
配置Debian 环境,保证用户访问权限。大家知道,在debian环境下,用户需要以root权限运行。因此,需要打开SSH端口,同时配置root 用户权限。
设置root权限设置:
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
service sshd restart
更新系统文件:
apt-get update && apt-get upgrade -y
安装系统依赖包:
apt-get install -y build-essential linux-headers-`uname -r` openssh-server apache2 mariadb-server\
mariadb-client bison flex php php-curl php-cli php-pdo php-mysql php-pear php-gd curl sox\
libncurses5-dev libssl-dev mpg123 libxml2-dev libnewt-dev sqlite3\
libsqlite3-dev pkg-config automake libtool autoconf git unixodbc-dev uuid uuid-dev\
libasound2-dev libogg-dev libvorbis-dev libicu-dev libcurl4-openssl-dev libical-dev libneon27-dev libsrtp0-dev\
libspandsp-dev sudo subversion libtool-bin python-dev unixodbc dirmngr php-mbstring sendmail
安装node.js
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs
然后reboot 服务器。
安装系统的支持包:
cd /usr/src/
wget https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.0.7/mariadb-connector-odbc-3.0.7-ga-debian-x86_64.tar.gz
tar vxfz mariadb-connector-odbc-3.0.7-ga-debian-x86_64.tar.gz
cp lib/libmaodbc.so /usr/lib/libmaodbc.so
安装 pear 支持包:
pear install Console_Getopt
下载安装Asterisk-16
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
下载安装Dahdi 支持语音板卡,如果没有语音板卡可以忽略此步骤:
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
如果无语音板卡,可以忽略。下载支持包以后,开始一步步编译相关软件包:
cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
rm -f dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
cd /usr/src
tar xvfz libpri-current.tar.gz
rm -f libpri-current.tar.gz
cd libpri-*
make
make install
编译Asterisk-16,可以选择其他的 CORE-SOUNDS and EXTRA-SOUNDS,但是FreePBX无需这些语音包。
cd /usr/src
tar xvfz asterisk-16-current.tar.gz
rm -f asterisk-16-current.tar.gz
cd asterisk-*
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install
./configure --with-pjproject-bundled --with-jansson-bundled
make menuselect.makeopts
menuselect/menuselect --enable app_macro --enable format_mp3 menuselect.makeopts
make
make install
make config
ldconfig
update-rc.d -f asterisk remove
安装配置FreePBX,创建用户访问权限:
useradd -m asterisk
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib/asterisk
rm -rf /var/www/html
修改Apache配置:
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.0/apache2/php.ini
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
service apache2 restart
配置ODBC 数据库连接:
cat <<EOF > /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib/libmaodbc.so
FileUsage = 1
EOF
cat <<EOF > /etc/odbc.ini
[MySQL-asteriskcdrdb]
Description = MySQL connection to 'asteriskcdrdb' database
Driver = MySQL
Server = localhost
Database = asteriskcdrdb
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
Option = 3
EOF
下载安装FreePBX:
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
tar vxfz freepbx-15.0-latest.tgz
rm -f freepbx-15.0-latest.tgz
cd freepbx
touch /etc/asterisk/{modules,ari,statsd}.conf
./start_asterisk start
./install -n
重新启动Apache:
a2enmod rewrite
service apache2 restart
安装后就可以访问相应的FreePBX界面来进行具体的IPPBX配置。此文档支持阿里云安装方式,也可以实现本地安装。