How to Install FreePBX 16 on AWS Debian 10 in No Time

Unleash the Power of Freepbx 16: How to Install It on Aws Debian 10 Instance – Step by Step Guide Forget the Frustration of Uploading Isos – Set Up Freepbx 16 on Aws Seamlessly

How to Install FreePBX 16 on AWS Debian 10 in No Time

Home » Blog » Cookbook » VoIP » FreePBX » How to Install FreePBX 16 on AWS Debian 10 in No Time
Learn how to install FreePBX 16 on AWS Debian 10 instance with this comprehensive tutorial, covering prerequisites, installation steps, and troubleshooting tips.
Table of Contents

Are you eager to harness the power of FreePBX 16 on AWS Debian 10 instance but feeling overwhelmed by the installation process? You’re not alone – setting up FreePBX can be a daunting and time-consuming task, especially when dealing with ISO uploads or cloud services that don’t support them. Fear not! This comprehensive, step-by-step guide will walk you through the entire process of installing FreePBX 16 on a Debian 10 instance on AWS, making it a breeze to unlock its potential and get your system up and running in no time.

Prerequisites

Before we get started, you need to make sure that you have the following prerequisites:

Note

This tutorial assumes that you are installing FreePBX 16 on a Debian instance on AWS. The steps may vary if you are installing on a different operating system or cloud platform.

Initial System Setup

Log in as ‘root’ User

Log in as, or switch to, the Root User

THIS IS IMPORTANT!!!

You must run the entire process as root. Attempting to use ‘sudo’ later on will not work. Please don’t ignore this. You must run this entire installer as the root user. If will be helpful to enable ssh logins as root. To do so, you need to change the line ‘PermitRootLogin without-password’ to ‘PermitRootLogin yes’ in /etc/ssh/sshd_config.

You can do this with the following commands.

SSH Config
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
service sshd restart
Enable SSH logins as root

Update Your System

Update your system’s package list and upgrade installed packages by running:

SSH Config
apt-get update && apt-get upgrade -y
Update and Upgrade Your System

Install the SURY Repository Signing Key

Install the required GnuPG package and add the SURY repository signing key and Add the SURY repository for PHP and update your system packages:

SSH Config
apt-get install gnupg2 -y
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.x.list
apt-get update && apt-get upgrade -y
Install the SURY Repository Signing Key, SURY Repository, Update and Upgrade your System

Install Required Dependencies

Install the necessary dependencies for FreePBX:

SSH Config
apt-get install -y build-essential linux-headers-'uname -r' openssh-server apache2 mariadb-server mariadb-client bison flex php7.4 php7.4-cli php7.4-common php7.4-mysql php7.4-gd php7.4-intl php7.4-xml php-pear curl sox libncurses5-dev libssl-dev mpig12 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 libc-6-dev libcurl4-openssl-dev libical-dev libneon27-dev libsrtp2-dev libspandsp-dev sudo subversion libtool-bin python-dev unixodbc dirmngr sendmail-bin sendmail
Install the dependencies for FreePBX

Install Node.js

Install Node.js on your system:

SSH Config
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Download Node.JS
Install NodeJS

Reboot Server

Reboot your server to ensure you’re running the latest Linux kernel:

SSH Config
reboot

Install Prerequisites

Ensure that you’re running the latest Linux kernel (at the time of writing, it was 4.19.0-16).

Install MariaDB ODBC and Configure for Asterisk

Download and install the MariaDB ODBC, then configure for Asterisk by following the steps:

SSH Config
cd /usr/src/
wget https://wiki.freepbx.org/download/attachments/202375584/libssl1.0.2_1.0.2u-1_deb9u4_amd64.deb
wget https://wiki.freepbx.org/download/attachments/122487323/mariadb-connector-odbc_3.0.7-1_amd64.deb
dpkg -i libssl1.0.2_1.0.2u-1_deb9u4_amd64.deb
dpkg -i mariadb-connector-odbc_3.0.7-1_amd64.deb
Download and install the MariaDB ODBC

MariaDB Warning!

If the MariaDB server works in ‘STRICT_TRANS_TABLES’ mode you need to change mode in /etc/mysql/my.cnf

Go to MySQL:

SSH Config
mysql

Set STRICT_TRANS_TABLES (it’s better if you enter these codes one line at a time):

SQL
set global sql_mode=STRICT_TRANS_TABLES;
set sql_mode=STRICT_TRANS_TABLES;

Review your changes:

SQL
SELECT @@SQL_MODE, @@GLOBAL.SQL_MODE

Exit MySQL

SQL
exit

Install and Configure Asterisk

Install Kernel Source for Asterisk

Run the following command to install the kernel source for Asterisk:

SSH Config
apt-get install linux-headers-$(uname -r)
Install Kernel Source for Asterisk

Download Asterisk Source Files

Download the Asterisk source files using the following command:

SSH Config
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
Download Asterisk source

Compile and Install Asterisk

Use the following commands to compile and install Asterisk (it’s better if you enter these codes one line at a time):

SSH Config
cd /usr/src
tar xvfz asterisk-16-current.tar.gz
Unzip the Asterisk Source file
SSH Config
rm -f asterisk-16-current.tar.gz
cd asterisk-*
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install
Install mp3 library addon and prerequisites for Asterisk
SSH Config
./configure --with-pjproject-bundled --with-jansson-bundled
Configure PJSIP Library and JASON data

Enter your ITU-T Telephone Code(country code). In my case it is Bangladesh so the code is 880 or 88. Then press Tab to select <OK> and hit Enter:

Enter your ITU-T Telephone Code country code
SSH Config
make menuselect.makeopts
Store build configuration options
SSH Config
menuselect/menuselect --enable app_macro --enable format_mp3 menuselect.makeopts
Enable macro support in the dialplan and mp3 format

Now enter the following commands and continue:

SSH Config
make
make install
make config
ldconfig
update-rc.d -f asterisk remove
Building, Installing, and Configuring Asterisk from Source Code

Install and Configure FreePBX

Create Asterisk User and Set Base File Permissions

Run the following commands to create the Asterisk user and set base file permissions

SSH Config
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
Create the Asterisk User and Set Base File Permissions

Few Small Modifications to Apache

Make a few small modifications to Apache by running the following commands:

SSH Config
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/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
a2enmod rewrite
service apache2 restart
Apache modification for FreePBX

Configure ODBC

Edit /etc/odbcinst.ini and add the following lines:

SSH Config
cat <<EOF > /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/local/lib/libmaodbc.so
FileUsage = 1
EOF
Paste MySQL configurations into ODCB

Edit or create /etc/odbc.ini and add the following section:

SSH Config
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
Paste Asterisk Database configurations into ODCB

Download and Install FreePBX

Download and install FreePBX using the following commands:

SSH Config
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-16.0-latest.tgz
tar vxfz freepbx-16.0-latest.tgz
rm -f freepbx-16.0-latest.tgz
touch /etc/asterisk/{modules,cdr}.conf
cd freepbx
./start_asterisk start
./install -n
Download Latest package of FreePBX
Install FreePBX

Install All FreePBX Modules

Run the following commands to install all FreePBX modules:

SSH Config
fwconsole ma disablerepo commercial
fwconsole ma installall
fwconsole ma delete firewall
fwconsole reload
fwconsole restart
Install all FreePBX modules

Configure Firewall Ports on AWS

You need to configure Firewall Ports to access FreePBX and make communicatios:

PortsTCP/UDPPurposePurpose
22TCPSSH ConsolePort used to allow SSH to the PBX from the outside world.
80TCPPBX GUI HTTP (Non HTTPS)Used to access the PBX Admin GUI
443TCPPBX GUI HTTPSUsed to access the PBX Admin GUI with SSL encryption
1194TCPOpenVPN serverUsed to connect OpenVPN clients to PBX VPN Server.
PBX Admin Access

For all ports visit FreePBX wiki

Access FreePBX Web Interface

That’s it! You can now start using FreePBX. Open up your web browser and connect to the IP address or hostname of your new FreePBX server.

Go to your newly installed FreePBX

You will see the Admin setup page, where you can set your admin account password and configure an email address to receive update notifications. To get help with Initial Configurations, go to this page.

There are approximately 50 additional modules that can be installed to enhance the usability of your FreePBX machine. You can install these via Module Admin.

Installing FreePBX on a Debian instance on AWS is not as scary as it sounds. With this tutorial, you can install FreePBX 16 on a Debian instance on AWS with ease. You can use FreePBX to set up a complete PBX system for your business or organization. If you encounter any issues during the installation process, please refer to the FreePBX wiki or community forum for assistance.

author avatar
roosho
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
share this article.
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 

Enjoying my articles?

Sign up to get new content delivered straight to your inbox.

Please enable JavaScript in your browser to complete this form.
Name