Home » Blog » Asterisk/Vicidial » How To Install FreePBX 16 on Debian 11 / Debian 10

How To Install FreePBX 16 on Debian 11 / Debian 10

How To Install FreePBX 16 on Debian 11

How To Install FreePBX 16 on Debian 11 – Debian 10 FreePBX is a web-based open source GUI (graphical user interface) that controls and manages Asterisk (PBX). This tutorial will help you to Install FreePBX 16 on Debian 11 / Debian 10 Linux system. A pre-requisite for this setup is Asterisk Server that has been installed, configured and confirmed to be running:

Step 1: Install MariaDB Database server

Run the commands below to install

sudo apt update
sudo apt -y install mariadb-server mariadb-client

Step 2: Installing Node.js on Debian

FreePBX has Node.js as a dependency, install it on your system by using the commands below:

sudo apt install nodejs npm

Check the version of Node.js installed:

$ node --version
v12.22.5

Step 3: Install and configure Apache Web Server

Install apache2 package from apt:

sudo apt -y install apache2

Then change Apache user to asterisk and turn on AllowOverride option :

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
sudo sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf

Remove default index.html page

sudo rm -f /var/www/html/index.html
sudo unlink  /etc/apache2/sites-enabled/000-default.conf

Step 4: Install PHP and required extensions

Add APT repository configuration dependencies:

sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2

Add the PHP packages APT repository to your Debian server.

echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list

Import repository key:

wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -

Remove any current version of PHP installed:

sudo apt remove php*

FreePBX is dependent on PHP, run the following commands to install php and required extensions.

sudo apt install php7.4-{mysql,cli,common,imap,ldap,xml,fpm,curl,mbstring,zip,gd,gettext,xml,json}

Install PHP Apache module:

sudo apt install libapache2-mod-php7.4

Update PHP variables

sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini
sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/cli/php.ini
sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.4/apache2/php.ini

Step 5: Install FreePBX 16 on Debian 11 / Debian 10

Install the following packages.

sudo apt install sox mpg123 lame ffmpeg sqlite3 git unixodbc dirmngr postfix  odbc-mariadb pkg-config libicu-dev

Configure ODBC:

sudo tee /etc/odbcinst.ini<<EOF
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
FileUsage = 1
EOF

sudo tee /etc/odbc.ini<<EOF
[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

Download the latest version of FreePBX 16 on Debian 11 / Debian 10:

sudo apt -y install wget
wget http://mirror.freepbx.org/modules/packages/freepbx/7.4/freepbx-16.0-latest.tgz

Extract the file:

tar xfz freepbx-16.0-latest.tgz
rm -f freepbx-16.0-latest.tgz

Install FreePBX 16 on Debian 11 / Debian 10

cd freepbx
sudo systemctl stop asterisk
sudo ./start_asterisk start
sudo ./install -n

If you have a root password for database server, use:

sudo ./install -n --dbuser root --dbpass password

Replace password with the root database password.

Sample installation output:

Done. All modules installed.
Updating Hooks...Done
Done installing modules
Taking too long? Customize the chown command, See http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf
Setting Permissions...
Setting base permissions...Done
Setting specific permissions...
32451 [============================]
Finished setting permissions
Generating default configurations...
Finished generating default configurations
You have successfully installed FreePBX

Install all Freepbx modules

sudo fwconsole ma disablerepo commercial
sudo fwconsole ma installall
sudo fwconsole ma delete firewall
sudo fwconsole reload
sudo fwconsole restart

Enable Apache Rewrite engine and restart apache2.

sudo a2enmod rewrite
sudo systemctl restart apache2

If you have an active ufw firewall, open http & https ports

sudo ufw allow proto tcp from any to any port 80,443

You have successfully installed FreePBX on Debian Linux server.

Create FreePBX systemd (startup script)

Create a systemd unit for auto-starting the service:

sudo tee /etc/systemd/system/freepbx.service<<EOF
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
[Install]
WantedBy=multi-user.target
EOF

Enable the service to autostart

sudo systemctl daemon-reload
sudo systemctl enable freepbx

Step 6: Access FreePBX Web Interface

Open your web browser and connect to the ip_address_or_hostname/admin of your new FreePBX server.

1. Create the first admin account

install-freepbx-ubuntu-18.04-set-username-min

When done providing admin user details, click “Create Account” to create the account. On the next page, you’ll get a login console.

You’ll get to FreePBX dashboard where you can manage your Asterisk PBX.

You now have FreePBX 16 running on Debian 11 / Debian 10 system.

Scroll to Top