Skip to content

Instantly share code, notes, and snippets.

@jfinstrom
Last active February 29, 2024 11:15
Show Gist options
  • Save jfinstrom/eb231587ab821538c6d53f46a0be41f9 to your computer and use it in GitHub Desktop.
Save jfinstrom/eb231587ab821538c6d53f46a0be41f9 to your computer and use it in GitHub Desktop.
How to Install FreePBX 16 on Debian 11 with Asterisk 16

FreePBX Documentation: How to Install FreePBX 16 on Debian 11 with Asterisk 16

Attribution: This was originally published at https://wiki.freepbx.org which has since been removed

READ FIRST

Manual installations of FreePBX are considered an EXPERTS ONLY exercise. This method provides the CORE functionality of FreePBX. Non-commercial modules may not function as expected. Certain modules and features may require additional software.

COMMERCIAL MODULES CANNOT BE INSTALLED ON THIS OS

Specifications

  • FreePBX 16
  • Asterisk 16 from Debian Bullseye package repository
  • PHP 7.4 (standard with Debian Bullseye)
  • 64-bit Intel/AMD (x86_64) platform

Step-by-step guide

Note: All commands are to be run as the root user, either by directly logging in as root or by using sudo su -.

  1. Prerequisite recommended OS update

    Update the OS to the current version.

    apt-get update
    apt-get upgrade
  2. Install Necessary Packages

apt install -y util-linux apache2 mariadb-server mariadb-client php php-curl php-cli php-pdo php-mysql php-pear php-gd php-mbstring php-intl php-bcmath curl sox mpg123 lame ffmpeg sqlite3 git unixodbc sudo dirmngr postfix asterisk odbc-mariadb php-ldap nodejs npm pkg-config libicu-dev
  1. Prepare Asterisk
 systemctl stop asterisk
 systemctl disable asterisk
 cd /etc/asterisk
 mkdir DIST
 mv * DIST
 cp DIST/asterisk.conf .
 sed -i 's/(!)//' asterisk.conf
 touch modules.conf
 touch cdr.conf
  1. Configure Apache Web Server
 sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini
 sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.4/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
  1. Configure OBDC
cat <<EOF > /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
FileUsage = 1
EOF
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
  1. Install FreePBX
cd /usr/local/src
wget http://mirror.freepbx.org/modules/packages/freepbx/7.4/freepbx-16.0-latest.tgz
tar zxvf freepbx-16.0-latest.tgz
cd /usr/local/src/freepbx/
./start_asterisk start
./install -n
  1. Install the rest of the modules
fwconsole ma installall
  1. Run Apply Config
fwconsole reload
  1. Set Symlinks to the correct sound files
cd /usr/share/asterisk
mv sounds sounds-DIST
ln -s /var/lib/asterisk/sounds sounds
  1. Restart FreePBX/Asterisk
fwconsole restart
  1. Setup 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
  1. Finish setup in the UI by going to http://yourIPorDomain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment