Skip to end of metadata
Go to start of metadata


Manual installations of FreePBX is considered an EXPERTS ONLY exercise. This method of installation is enough to get CORE functionality of FreePBX. Non-commercial 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.


This manual-install method builds a FreePBX system with the following specifications:

  • FreePBX 16
  • Asterisk 16 from the Debian Bullseye package repository
  • PHP 7.4, standard with Debian Bullseye
  • 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 11 installation. All necessary packages will be installed through the following commands.

Prerequisite recommended OS update

Update the OS to current.

  • apt-get update
  • apt-get upgrade

Install all the 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

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

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

Configure ODBC

  • cat <<EOF > /etc/odbcinst.ini
    Description = ODBC for MySQL (MariaDB)
    Driver = /usr/lib/x86_64-linux-gnu/odbc/
    FileUsage = 1
  • cat <<EOF > /etc/odbc.ini
    Description = MySQL connection to 'asteriskcdrdb' database
    Driver = MySQL
    Server = localhost
    Database = asteriskcdrdb
    Port = 3306
    Socket = /var/run/mysqld/mysqld.sock
    Option = 3

Install FreePBX

  • cd /usr/local/src
  • wget
  • tar zxvf freepbx-16.0-latest.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

Note on modules that fail to install

digiumaddoninstaller, firewall, and xmpp will not install. Firewall will not work without sysadmin (a free but commercial module); xmpp will not work without MongoDB. If you want XMPP, install MongoDB from the vendor's repo first.

ucp will install but the UCP node server will not start due to an incompatibility with NodeJS 12.x. A ticket and patch have been submitted to resolve the incompatibility and this note will be removed when ucp has been updated.

Apply the current configuration

  • fwconsole reload

Set symlinks to the correct sound files

  • cd /usr/share/asterisk
  • mv sounds sounds-DIST
  • ln -s /var/lib/asterisk/sounds sounds

Perform a restart to load all Asterisk modules that had not yet been configured

  • fwconsole restart

Set up systemd (startup script)

  • cat <<EOF > /etc/systemd/system/freepbx.service
    Description=FreePBX VoIP Server
    ExecStart=/usr/sbin/fwconsole start -q
    ExecStop=/usr/sbin/fwconsole stop -q
  • systemctl daemon-reload
  • systemctl enable freepbx

Asterisk and FreePBX 16 are installed! Go to the web interface at http://YOUR-IP to finish setup.

Questions or support?

Please post your questions or ask for help on the community forums


  1. I used these instructions to install on a raspberry pi in a Debian/11 LXD container. There was no odbc-mariadb package, so had to add odbcinst, cron
     and wget packages. Container was created using `lxc launch images:debian/11/armhf fpbx`. I skipped 'fwconsole ma installall' since the installation got broken afterwards due to ucp.

    For CDR report to show up, setup

    #cat /etc/

    Description = ODBC for MySQL (MariaDB)
    Driver = /usr/local/lib/
    FileUsage = 1

    The can be obtained from RASPBX install. Also, Installing FreePBX 16 on Debian 10.9#InstallMariaDBODBC

    1. Correct; right now, odbc-mariadb is not packaged for ARM. You have to build it yourself or find it from another source.

    2. FWIW this page used to have an ARM-specific part, see version 3 in history ( )

      1. I built deb packages for the arm architectures and will post them along with instructions how to install them since they do not get installed from the apt repo.

        1. Hi, any progress on the ARM support? I am eager to install it on my SBCs. Thank you.

            1. I am installing a 32-bit system.  I installed odbc-mariadb_3.1.9-1_armhf.deb per the above, but I cannot find where it put not in /usr/lib/x86_64-linux-gnu/odbc/ per your instructions.  I assume that I need to substitute the proper location of, but I it is not in /usr/lib.  Any ideas?

              1. /usr/lib/arm-linux-gnueabihf/odbc/

  2. I was getting an error when trying to get the details of a call in Reports>CDR Report>'Search'>Click on UniqueID under System column.

    1. Let's troubleshoot it on the forum since it may not be related to this install guide.

  3. I was getting an error when calling fwconsole ma installall.

    In modulefunctions.class.php line 454:

    implode(): Passing glue string after array is deprecated. Swap the parameters

    It seems that it is a simple bug to be fixed, by just swapping the parameters. But how is this bug caused? It should be fixed by using a proper PHP version I guess?

    FYI, I am using Debian 11, and it was installed earlier today, without any other changes before I started to install FreePBX following this instruction.

    Thank you very much. Any information is appreciated.

    1. There was a bug released into the installer:  FREEPBX-22834 - Getting issue details... STATUS

      Download the updated framework and then proceed with installall or upgrade.

      1. Thanks! It works!

  4. Please update:

    • sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.4/apache2/php.ini


    • sed -i 's/\(^memory_limit = \).*/\256M/' /etc/php/7.4/apache2/php.ini

    Please ignore this comment, OP is correct!  (smile)

    1. No, the original is correct. Try it and you will see.

  5. Awesome guide!

    Thank you!

    1. You have misread the command. We move the config files that were provided by the Debian packaging into a subdirectory called "dist" under /etc/asterisk. Alternatively you could delete them but you must create the asterisk.conf file. 

      There is no situation where you do a large upload using PHP from the CLI so it is not necessary to make the adjustment you are recommending.

  6. Thanks for the info.  Would it be overkill for these instructions to include a mention that the user should consider running the command to secure their MariaDB (MySQL) installation? ...

    • /usr/bin/mysql_secure_installation

    ... followed by updating the FreePBX install command to:

    • ./install -n --dbuser root --dbpass "mysqlrootpassword"

    ... just my suggestion.

  7. Streaming MoH is not working.  I have checked that mpg123 is installed.  Installing ffmpeg adds a mind boggling 400+ Mb worth of installs.  Anyway, streaming MoH fails with a two part error. 1) An Error occured trying to submit this document. 2) Invalid dateline format: 1366 Incorrect integer value: " for ....column `asterisk`.`music`.`random` at row 1. File:/var/www/html/admin/modules/music/Music.class.php:135

    1. Please submit a bug report with your findings to

  8. Hello, in the Apache-logs I get something like this:

    client denied by server configuration /var/www/html/admin/index.cgi
    client denied by server configuration /var/www/html/admin/

    Any idea what could be the problem?

    1. Those files do not exist and are not part of FreePBX. Perhaps someone is scanning your server. Ignore it or set up firewall rules to block.

  9. For non English users, you should add two lines in your script to prevent a brutal error for a non existing _() function, which is the function used by gettext for internationalisation. These lines activate the gettext extension in the cli (necessary for your script) and in apache2 (necessary for FreePbx).

        sed -i 's/;extension=gettext/extension=gettext/' /etc/php/7.4/cli/php.ini

        sed -i 's/;extension=gettext/extension=gettext/' /etc/php/7.4/apache2/php.ini

    I had also a problem : the red warning "Impossible to connect to Asterisk". The reason was that AMI was not running. I didn't understand where was the problem in installation. The symptom is there is only a few files (4 if I remember well) in /etc/asterisk, and the important file manager.conf is not there.

    The solution is simple this file and the two others necessary are present in the DIST subdirectory. I just copied

    • manager.conf
    • manager_additional.conf
    • manager_custom.conf

    in /etc/asterisk.

    And to activate it :

        sudo asterisk -r

        manager reload

    And when loading FreePbx, the red message had disappeared. And as an immediate consequence, I got a lot of files in /etc/asterisk

    Thanks for your job, Bill, it was very helpfull

  10. Thank you so much for this guide! I just want to mention that it worked PERFECTLY for installing FreePBX on a Raspberry Pi 4 running Ubuntu 20.04 LTS. The whole process, starting with a blank microSD card and finishing with restoration of a FreePBX backup, took about 2 hours. There are various guides and tools on the Internet for installing FreePBX on Ubuntu, and I've tried several of them. They should all now be regarded as obsolete. Use this one.

    Three notes: My Pi has 8 GB of memory, and I believe Ubuntu works less well, or possibly not at all, with less memory. Also, see the other comment for a link to an odbc-mariadb package built for ARM64. Finally, I should mention that I installed some of Ubuntu's other asterisk packages, in addition to those specified in the guide. I just picked some that seemed possibly relevant. Whether that makes a difference or not, I don't know.

    Thanks again!

    1. Thanks for your feedback!

  11. Trying to install on Raspberry Pi Bullseye (11) 32 bit.  I got odbc-mariadb insalled manually, but am stuck on:

    • mkdir DIST
    • mv * DIST

    /etc/asterisk was empty until the mkdir, plus, you cannot move DIST to itself.  What is correct here?

    1. When you install the asterisk package, /etc/asterisk is populated with default configs. Moving * to DIST (and ignoring the error that DIST cannot be moved into itself) moves those default configs aside, and then you copy the critical asterisk.conf back into place and create empty modules.conf and cdr.conf with the touch command.

  12. I really appreciate these instructions and the help I have gotton so far.  I am installing the 32-bit version on a Raspberry Pi Zero W.  Along the way I encountered 5 issues:

    1. When I tried to install php-pdo it said I should install php7.4-common instead.  I did, but it said it was already installed.
    2. odbc-mariadb was not found, so I installed odbc-mariadb_3.1.9-1_armhf.deb manually with no errors.  I adjused the contents of /etc/odbcinst.ini to show the driver as /usr/lib/arm-linux-gnueabihf/odbc/
    3. the npm audit found some issues, which I did not fix, because they wre not csalled errors.
    4. The install of FreePbx could not find certman.
    5. The fwcolsole reload worked, but when I got to fwconsole retart, it said: 

      In Start.class.php line 193:
      Unable to connect to Asterisk. Did it start?

    What am I doing wrong?

    UPDATE: I have done bunches of troubleshooting, and the problem is /usr/lib/arm-linux-gnueabihf/odbc/ in /etc/odbcinst.ini.  If I change to a garbage path (that does not exist), fwconsole restart works., but I get not CDRs.

    This looks like a problem with /usr/lib/arm-linux-gnueabihf/odbc/  I installed it by scp'ing your odbc-mariadb_3.1.9-1_armhf.deb to my Pi an installing it with "apt install -f /path/to/odbc-mariadb_3.1.9-1_armhf.deb".  Is that correct?  It clearly is the issue with Asterisk not starting.

    ANOTHER UPDATE:  I put back the proper path to  I check the full aterisk gets to here:


    Then, it restarts...over and over again.  Clearly it cannot load if /etc/odbcinst.ini has the proper path to

    Now what?

  13. hey everyone,
    I have the problem that I haven't had any inbound calls since an update, but outbound works

    FreePBX 16 on arm Base (Turris Omnia LXC with Debian 11)

  14. For the installation of the ODBC driver for FreeBPX 16 to work with the Asterisk 16 setup under the Debian 11 Bullseye OS for the ARM architecture, you may follow these steps (as I have done for a Raspberry Pi device):

    sudo sh -c 'cat > /etc/apt/preferences.d/jessie' << EOF
    Package: *
    Pin: release n=bullseye
    Pin-Priority: 900
    Package: *
    Pin: release n=jessie
    Pin-Priority: 100

    sudo sh -c 'echo "deb jessie main" >> /etc/apt/sources.list'

    sudo sh -c 'echo "deb jessie main" >> /etc/apt/sources.list.d/raspi.list'

    sudo apt update ; sudo apt -y install unixodbc libmyodbc sqlite3  

    sudo sh -c 'cat > /etc/odbcinst.ini' << EOF
    Description = ODBC for MariaDB
    Driver = /usr/lib/arm-linux-gnueabihf/odbc/
    Setup = /usr/lib/arm-linux-gnueabihf/odbc/
    FileUsage = 1

    sudo sh -c 'cat > /etc/odbc.ini' << EOF
    Description=MariaDB connection to 'asteriskcdrdb' database

    Above steps will install the libmysqlclient18, multiarch-support and libmyodbc packages from a previous Debian release that will work fine with the current OS release.

    You can test the ODBC driver and its configuration with the commands sudo odbcinst -s -q and sudo odbcinst -j respectively.