Table of Contents
1) Preparing the environment
To install Debian, I recommend using a virtual machine created on Proxmox. If you haven’t used this virtualization environment yet, visit our blog and try install and configure proxmox yourself . In another post we describe how to install an example Linux in such an environment. I also encourage you to read the description of installing Asterisk 20 on Debian 12 and to pay attention to how to solve a possible problem with libasteriskssl or libasteriskpj
After the basic installation of the operating system, it is good practice to upgrade and update it. This allows us to be sure that we are using the latest versions of updates and fixes. Thanks to this, we increase the level of security and reliability of our environment.
apt update
apt upgrade
nano, wget and tar
in the package. We will also install the curl
package for our needs.
apt install curl
/usr/src
directory, where I also download the appropriate version of Asterisk and unpack it. Although we could download the latest version 20, on the FreePBX website we can see that it is not still officially supported. I will get rid of the zipped file and go to the directory where I will have access to the basic installer.
cd /usr/src/
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
tar -zxvf asterisk-18-current.tar.gz
rm asterisk-18-current.tar.gz
cd asterisk-18.*
2) Asterisk installation
contrib/scripts/install_prereq install
contrib/scripts/get_mp3_source.sh
./configure
FreePBX
, we will add the required components. The following command will give us graphical access to the menu in which, firstly, we will add support for the mp3 format and a channel supporting communication using the H.323 protocol (chan_ooh323)
make menuselect
HINT
make menuselect.makeopts \
&& menuselect/menuselect --enable CORE-SOUNDS-EN-WAV CORE-SOUNDS-EN-ULAW CORE-SOUNDS-EN-ALAW CORE-SOUNDS-EN-GSM CORE-SOUNDS-EN-G729 CORE-SOUNDS-EN-G722 CORE-SOUNDS-EN-SLN16 \
&& menuselect/menuselect --enable MOH-OPSOUND-WAV MOH-OPSOUND-ULAW MOH-OPSOUND-ALAW MOH-OPSOUND-GSM MOH-OPSOUND-G729 MOH-OPSOUND-G722 MOH-OPSOUND-SLN16 \
&& menuselect/menuselect --enable EXTRA-SOUNDS-EN-WAV EXTRA-SOUNDS-EN-ULAW EXTRA-SOUNDS-EN-ALAW EXTRA-SOUNDS-EN-GSM EXTRA-SOUNDS-EN-G729 EXTRA-SOUNDS-EN-G722 EXTRA-SOUNDS-EN-SLN16 \
&& menuselect/menuselect --disable BUILD_NATIVE --enable format_mp3 --enable chan_ooh323 --enable app_macro
make
make install
make samples
make config
ldconfig
3) Asterisk configuration
asterisk
. Its home directory will be /var/lib/asterisk
groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
audio
and dialout
groups. The audio
group has permissions related to audio support, while the dialout
group has permissions related to access to connection devices (for example, modems). Adding the asterisk
user to these groups is necessary to allow them access to certain system functions related to audio and calling.
usermod -aG audio,dialout asterisk
chown -R asterisk:asterisk /etc/asterisk
chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk
chown -R asterisk:asterisk /usr/lib/asterisk
In two Asterisk configuration files, we will set our asterisk user as the default user under which the Asterisk system itself will be run. You should uncomment the following lines to the state shown below:
nano /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"
nano /etc/asterisk/asterisk.conf
runuser = asterisk
rungroup = asterisk
systemctl restart asterisk
systemctl enable asterisk
asterisk -rvvv
It is not an important problem that needs to be addressed now, if after starting Asterisk, we see some warnings and errors related to module loading, similar to the ones below.
modules.conf
file you can disable the autoload = yes
option and load modules manually.
nano /etc/asterisk/modules.conf
make menuselect
command (point 2), for example those visible in the screenshot above. 4) Database installation and configuration
apt install mariadb-server mariadb-client
/usr/bin/mysql_secure_installation
mysql -V
5) Node.js installation
Node.js
is another component that FreePBX
requires to properly interact with the website. The installer requires little interaction with the user, so after running it, click Y
. We also install the package manager for the Node.js
environment, i.e. npm
. Without it, our website would work, but we would get a lot of errors and we would not be able to reload the FreePBX configuration, for example.
apt install nodejs npm
Node.js
has been installed correctly by showing us its version.
node -v
6) Apache installation and configuration
apache
is necessary for FreePBX
to work. This installer also requires little interaction with the administrator, so at some point we just click Y
apt install apache2
apache2.conf
file and look at the place we are most interested in, shown in the clipping below.
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_backup
nano /etc/apache2/apache2.conf
/etc/apache2/envvars
. So let’s make the necessary changes there. Enter our user asterisk
. The relevant fragment of this file will look like this:
cp /etc/apache2/envvars /etc/apache2/envvars.backup
nano /etc/apache2/envvars
export APACHE_RUN_USER=asterisk
export APACHE_RUN_GROUP=asterisk
/etc/apache2/apache2.conf
we need to replace all occurrences of AllowOverride None
with AllowOverride All
. This will enable FreePBX to flexibly configure the website. You can do this by editing the file manually, but it is more elegant to use the sed
command, which I encourage you to do.
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
index.html
file
rm -f /var/www/html/index.html
7) PHP installation
php.list
for the older version of php and fill it with the following content. Additionally, we will check the code name of our Debian system (in our case it is bookworm)
lsb_release -sc
nano /etc/apt/sources.list.d/php.list
deb https://packages.sury.org bookworm main
HINT
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -
apt-key is deprecated
We can ignore it. We will not use the new key management method in this case. ATTENTION
apt update
apt install php7.4
apt install libapache2-mod-php7.4 php7.4-{cgi,common,curl,mbstring,gd,mysql,gettext,bcmath,zip,xml,imap,json,snmp,fpm}
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/cli/php.ini
rewrite
. This module allows you to use the URL rewriting function in the Apache server. For everything to work, we need to restart the Apache service.
a2enmod rewrite
systemctl restart apache2
8) FreePBX installation
/usr/src
cd /usr/src
wget https://mirror.freepbx.org/modules/packages/freepbx/freepbx-16.0-latest.tgz
tar -zxvf freepbx-16.0-latest.tgz
rm freepbx-16.0-latest.tgz
cd freepbx/
./start_asterisk start
./install -n --dbuser root --dbpass "SQLPa$$w0rd"
reboot
9) FreePBX configuration
Now we can log in to the FreePBX graphical interface via a web browser. Go to the website by entering the IP address of your Asterisk system.
http:///admin/config.php
Setup System
FreePBX Administration
and enter username and password. Apply Config
to save our configuration files to Asterisk. The reloading
message will disappear after this operation is performed. As you can see, we have the System Overview
tab here, where we can find potential problems and warnings. This time there is information about the missing SOX
module.
apt install sox
Menu Admin -> Module Admin
. There, click Check Online
and then Download All
and Process
. You will see a window showing the installation process. Return
. You will return to the main panel. There, confirm the performed operations with the Apply Settings
button. From now on, you can enjoy a fully equipped and functional telephone exchange environment.