(Last Updated On: November 25, 2018)

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 15 on Ubuntu 18.04 / 16.04 / Debian 9. A pre-requisite for this setup is Asterisk Server. Install Asterisk on Ubuntu 18.04 / 16.04 / Debian 9 using below guide:

How to Install Asterisk 16 LTS on Ubuntu 18.04 / 16.04 / Debian 9

Step 1:  Install MariaDB Database server:

Use below links to install MariaDB on both Ubuntu 18.04 / Ubuntu 16.04 and Debian 9

Install MariaDB 10.x on Ubuntu 18.04 and CentOS 7

How to Install MariaDB 10.3 on Debian 9 / Debian 8

Step 2: Installing Node.js 10 LTS

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

Installing Node.js 10 LTS on Ubuntu 18.04 / 16.04 / Debian 9

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

Step 4: Install PHP and required extensions

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

sudo apt -y install wget php php-pear php-cgi php-common php-curl php-mbstring php-gd php-mysql php-gettext php-bcmath php-zip php-xml php-imap php-json php-snmp php-fpm libapache2-mod-php
Change php maximum file upload size:

For Debian 9 / Ubuntu 16.04:

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

For Ubuntu 18.04:

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

Step 5: Download and Install FreePBX 15 on Ubuntu 18.04 / 16.04 / Debian 9

Download the latest version of FreePBX 15:

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

Extract the file:

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

Install FreePBX 15 on Ubuntu 18.04 / 16.04 / Debian 9

cd freepbx
sudo ./start_asterisk start
sudo ./install -n

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

./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

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 15 on Ubuntu 18.04 / 16.04 / Debian 9 server.

Step 6: Access FreePBX 15 Web Interface

Open your web browser and connect to the IP address or hostname of your new FreePBX server.

1. Create the first admin account

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 15 running on Ubuntu 18.04 / 16.04 / Debian 9.