cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo >/etc/apt/sources.list
vim /etc/apt/sources.list
# Then paste the following content into sources.list file
deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
You also need to add the ppa source, because you need to install php5.6 when you install the dependencies in the second step. If you don't add it, you will be prompted to find the package when apt-get install.
apt-get install -y language-pack-en-base
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
add-apt-repository ppa:ondrej/php
Perform update mirror list.
apt update
apt-get install -y build-essential linux-headers-`uname -r` openssh-server apache2 mysql-server mysql-client bison flex php5.6 php5.6-curl php5.6-cli php5.6-xml php5.6-mysql php-pear php5.6-gd libapache2-mod-php5.6 curl sox libncurses5-dev libssl-dev libmysqlclient-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
During the installation of mysql, a window prompting for setting a password will pop up several times, here we can directly press Enter, and set a blank password by default to avoid problems during subsequent installation of Asterisk
When installing php5.6, php-pear, libssl-dev, libxml2-dev, libicu-dev, libneon27-dev, the download speed will be slower
After the installation is complete, switch php to php5.6.
sudo a2dismod php7.1
sudo a2enmod php5.6
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Download source package
cd /usr/src
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
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
Compile and install dahdi
tar -zxvf dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete*
make all
make install
make config
tar -zxvf tar -zxvf libpri-current.tar.gz
cd libpri*
make
make install
Compile and install Asterisk
tar -zxvf asterisk-16-current.tar.gz
cd asterisk*
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install
# Here is a pop-up window that requires the user to fill in the country’s phone code, China is 86./configure --with-pjproject-bundled --with-jansson-bundled
make menuselect
# A pop-up window will appear here, asking you which modules you need to enable, press enter to enable the corresponding module, the default is OK
make
make install
make config
ldconfig
update-rc.d -f asterisk remove
Create Asterisk user and set basic file permissions
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
Modify the apache2 configuration file
sed -i 's/\(^upload_max_filesize = \).*/\120M/'/etc/php/5.6/apache2/php.ini
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak
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
Configure ODBC
# edit/etc/odbcinst.ini and add the following.
[ MySQL]
Description = ODBC for MySQL
Driver =/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup =/usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage =1
# Edit or create/etc/odbc.ini and add the following parts.
[ MySQL-asteriskcdrdb]
Description=MySQL connection to 'asteriskcdrdb' database
driver=MySQL
server=localhost
database=asteriskcdrdb
Port=3306
Socket=/var/run/mysqld/mysqld.sock
option=3
Officially compile and install FreePBX
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
tar vxfz freepbx-15.0-latest.tgz
cd freepbx
touch /etc/asterisk/ari.conf
. /start_asterisk start
. /install -n
Restart apache
a2enmod rewrite
service apache2 restart
Recommended Posts