配置Debian 環(huán)境,保證用戶訪問權限。大家知道,在debian環(huán)境下,用戶需要以root權限運行。因此,需要打開SSH端口,同時配置root 用戶權限。
設置root權限設置:
- sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
- service sshd restart
更新系統(tǒng)文件:
apt-get update && apt-get upgrade -y
安裝系統(tǒng)依賴包:
- 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 服務器。
安裝系統(tǒng)的支持包:
- 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,創(chuàng)建用戶訪問權限:
- 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 數(shù)據(jù)庫連接:
- 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配置。此文檔支持阿里云安裝方式,也可以實現(xiàn)本地安裝。