fbpx
Home » Blog » A Comprehensive Guide to Manual Installation of FreePBX 17

A Comprehensive Guide to Manual Installation of FreePBX 17

FreePBX 17 with Asterisk 20: FreePBX is a robust and versatile open-source communication platform, enabling organizations to establish and manage their PBX systems efficiently. While the installation process is typically straightforward, manual installations of FreePBX, as detailed in this guide, are recommended for experts due to their complexity. This method provides core functionality for FreePBX but may require additional software configurations for specific modules and features. It’s important to note that as of October 2023, FreePBX 17 is in beta, intended for testing purposes and not suitable for production environments.

System Specifications

This manual installation method is designed to build a FreePBX system with the following specifications:

  • FreePBX 17
  • Asterisk 20
  • PHP 8.2
  • MariaDB (v10.11)
  • Node JS (v18.16)
  • 64-bit Intel/AMD (x86_64) platform

Step-by-Step Installation Guide FreePBX 17 with Asterisk 20

All commands should be executed as the root user, either by directly logging in as root or by using the “sudo su -” command.

Update the operating system (OS) to ensure you have the latest packages and security updates.

apt-get update
apt-get upgrade

Install essential packages:

apt -y install build-essential git curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev libjansson-dev libxml2-dev uuid-dev default-libmysqlclient-dev htop sngrep lame ffmpeg mpg123
apt -y install git vim curl wget libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev expect

2. PHP 8.2 Installation

Ensure you have PHP 8.2 installed, as FreePBX 17 requires this specific version. Remove any older or newer PHP versions if present:

apt-get purge phpX.*

Install PHP 8.2:

apt-get install -y build-essential linux-headers-`uname -r` openssh-server apache2 mariadb-server mariadb-client bison flex php8.2 php8.2-curl php8.2-cli php8.2-common php8.2-mysql php8.2-gd php8.2-mbstring  php8.2-intl php8.2-xml php-pear curl sox libncurses5-dev libssl-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 odbc-mariadb libical-dev libneon27-dev libsrtp2-dev  libspandsp-dev sudo subversion libtool-bin python-dev-is-python3 unixodbc vim wget libjansson-dev software-properties-common nodejs npm ipset iptables fail2ban php-soap

3. Asterisk 20 Installation

Download Asterisk source, compile, and install it:

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz
tar xvf asterisk-20-current.tar.gz
cd asterisk-20*/
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install
./configure  --libdir=/usr/lib64 --with-pjproject-bundled --with-jansson-bundled
make menuselect.makeopts
menuselect/menuselect --enable app_macro menuselect.makeopts
make menuselect
make
make install
make samples
make config
ldconfig

4. Create Asterisk User and Permissions

Set up the necessary permissions for the Asterisk user:

groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
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/lib64/asterisk

Update configuration files:

sed -i 's|#AST_USER|AST_USER|' /etc/default/asterisk
sed -i 's|#AST_GROUP|AST_GROUP|' /etc/default/asterisk
sed -i 's|;runuser|runuser|' /etc/asterisk/asterisk.conf
sed -i 's|;rungroup|rungroup|' /etc/asterisk/asterisk.conf
echo "/usr/lib64" >> /etc/ld.so.conf.d/x86_64-linux-gnu.conf
ldconfig

5. Configure Apache Web Server

Configure Apache settings for FreePBX:

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/8.2/apache2/php.ini
sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/8.2/apache2/php.ini
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
a2enmod rewrite
systemctl restart apache2
rm /var/www/html/index.html

6. Configure ODBC

Set up ODBC configurations for MySQL:

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

Create an ODBC configuration file:

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

7. Install FreePBX 17 with Asterisk 20

cd /usr/local/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-17.0-latest-EDGE.tgz
tar zxvf freepbx-17.0-latest-EDGE.tgz
cd /usr/local/src/freepbx/
./start_asterisk start
./install -n

8. Additional Modules

At this stage, you have a basic system. To enhance functionality, you can install all modules:

fwconsole ma installall
fwconsole reload
fwconsole restart

9. Set Up systemd (Startup Script)

Create a systemd service for 17 with Asterisk 20:9. Set Up systemd (Startup Script)

cat <<EOF > /etc/systemd/system/freepbx.service
[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
systemctl daemon-reload
systemctl enable freepbx

10. Troubleshooting Tips

If you encounter access issues when accessing FreePBX from a different subnet, run the following command, replacing X with the relevant IP address:

ufw allow from X

This guide provides a comprehensive walkthrough of the manual installation process for FreePBX 17, catering to experts who seek to set up a robust telephony system with precise control and customization options. It’s important to follow each step meticulously to ensure a successful installation of this powerful communication platform.

My Personal Journey with FreePBX 17 with Asterisk 20 Manual Installation

My venture into manually installing FreePBX 17 was a captivating exploration. Designed for experts, this process unlocked the potential of FreePBX while offering invaluable insights.

Beginning with a meticulous OS update, I ensured that the Debian 12 base was fortified with the latest packages. Installing PHP 8.2, a prerequisite for FreePBX 17, made the system compatible, while Asterisk’s installation involved source code compilation and intricate configuration.

Configuring the Apache web server and setting up ODBC for MySQL were vital steps, enabling secure web access and seamless database interaction.

The installation of FreePBX was a defining moment, guided by a step-by-step script. Adding modules expanded FreePBX’s functionality, covering a spectrum of communication needs.

Setting up systemd for management ensured consistent performance. Troubleshooting challenges along the way enhanced my skills and deepened my understanding.

In the end, this experience not only delivered a functional telephony platform but also a mastery of its intricacies. It exemplified the rewards of technology exploration, enriching my knowledge and skills in open-source telephony.

Scroll to Top