READ FIRST
Manual installation of FreePBX is considered an EXPERTS ONLY exercise. This method of installation is enough to get CORE functionality of FreePBX. Some modules may not function as expected or detailed in the Wiki's. Certain modules and features may require additional software to be installed and configured on the server.
OCTOBER 2023 - FREEPBX 17 IS BETA SOFTWARE. AS OF THIS DATE IT IS FOR TESTING ONLY AND NOT SUITABLE FOR PRODUTION.
This manual-install method builds a FreePBX system with the following specifications:
FreePBX 17
Asterisk 20
PHP 8.2
Maria DB (v10.11)
Node JS (v18.16)
64-bit Intel/AMD (x86_64) platform
Step-by-step guide
All commands are to be run as the root user, either by directly logging in as root or by using sudo su -
.
Start from a base Debian 12 installation. All necessary packages will be installed through the following commands.
Prerequisite recommended OS update
Update the OS to current and install the required packages
apt-get update apt-get upgrade 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 |
PHP 8.2 Installation
If the host Debian OS do not have PHP 8.2 then installed below required packages.
FreePBX 17 supports PHP 8.2 only so if you are running older PHP version or newer PHP version then please remove that version and install the PHP 8.2 version.
Removing PHP version - "apt-get purge phpX.*" where X is the PHP version for example 7 for PHP v7.2 or 8 for PHP 8.1
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 |
Asterisk Installation
Download asterisk source and compilation
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 |
Create asterisk user and give permission
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 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 |
Configure Apache web server
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 |
Configure ODBC
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 |
Install FreePBX
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 |
Get the rest of the modules
Only a very basic system is installed at this point. You will probably want to install all the modules. Alternatively, you can skip this and pick-and-choose the individual modules you want later.
fwconsole ma installall fwconsole reload fwconsole restart |
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 |
Troubleshooting Tips
If the Network/subnet is different then you need to run the below command to get the GUI access.
# ufw allow proto tcp from any to any port 80,443