FreePBX is an open-source web-based graphical user interface that controls and manages Asterisk.
In this article, we explain how to install FreePBX on Ubuntu 24.04 LTS, but the procedure is also valid for most distributions based on Debian.
System Preparation:
The first thing you need to do is update the repositories:
# apt update && apt upgrade -y
Install the dependencies required for the Asterisk installation:
# apt install unzip git gnupg2 curl libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev subversion -y
Asterisk Installation
Download the Asterisk package and unzip it:
# wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-22-current.tar.gz
# tar zxf asterisk-22-current.tar.gz
Now access the directory and install the required dependencies:
# cd asterisk-22.*/
# contrib/scripts/get_mp3_source.sh
# contrib/scripts/install_prereq install
After running the above commands, the script will download and install all the necessary packages. Then, it will display a success message similar to the one shown below:
Current status: 1 (-14) upgradable.
#############################################
## install completed successfully
#############################################
Now you will need to configure Asterisk:
# ./configure
# make menuselect
Once you use the above commands, a tab will appear with the add-ons required (you only need to enable the modules marked with *):
You also need to enable the sound modules, the Music on hold packages, and the Extras Sound:
To exit and save, press F12.
To install Asterisk with its respective templates, use the following commands:
# make -j2
# make install
# make samples
# make config
# ldconfig
Asterisk Configuration:
Now you need to create a user and group for Asterisk, then add it to the relevant group:
# groupadd asterisk
# useradd -r -d /var/lib/asterisk -g asterisk asterisk
# usermod -aG audio,dialout asterisk
Assign ownership permissions to the Asterisk user:
# chown -R asterisk:asterisk /etc/asterisk
# chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk
# chown -R asterisk:asterisk /usr/lib/asterisk
Now open the file /etc/default/asterisk and assign the Asterisk user as the default user by uncommenting AST_USER and AST_GROUP.
# sed -i 's/#AST_USER="asterisk"/AST_USER="asterisk"/' /etc/default/asterisk
# sed -i 's/#AST_GROUP="asterisk"/AST_GROUP="asterisk"/' /etc/default/asterisk
First test the above commands to make the change automatically and then verify if it works; otherwise, you can do it manually:
# nano /etc/default/asterisk
AST_USER="asterisk"
AST_GROUP="asterisk"
Now open the file /etc/asterisk/asterisk.conf and uncomment both runuser and rungroup:
# sed -i 's/;runuser = asterisk/runuser = asterisk/' /etc/asterisk/asterisk.conf
# sed -i 's/;rungroup = asterisk/rungroup = asterisk/' /etc/asterisk/asterisk.conf
First test the above commands to make the change automatically and then verify if it works; you can do it manually:
# nano /etc/asterisk/asterisk.conf
runuser = asterisk
rungroup = asterisk
Restart Asterisk:
# systemctl restart asterisk
At this point, if you check the status:
# systemctl status asterisk
You will see the following error:
radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/radiusclient.conf: No such file or directory
To resolve it, use the following commands to replace and modify the configuration errors:
# sed -i 's";\[radius\]"\[radius\]"g' /etc/asterisk/cdr.conf # sed -i 's";radiuscfg = /usr/local/etc/radiusclient-ng/radiusclient.conf"radiuscfg = /etc/radcli/radiusclient.conf"g' /etc/asterisk/cdr.conf # sed -i 's";radiuscfg = /usr/local/etc/radiusclient-ng/radiusclient.conf"radiuscfg = /etc/radcli/radiusclient.conf"g' /etc/asterisk/cel.conf
Now, if you restart the service and check the status, everything should work fine:
# systemctl restart asterisk
# systemctl status asterisk
Finally, connect to the command line with the command:
# asterisk -vvvr
To exit the CLI, use:
# exit
FreePBX Installation
Install nodejs, mariadb, apache2, and php to be able to install FreePBX:
# apt install nodejs mariadb-server apache2 php libapache2-mod-php php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-bcmath php-json php-sqlite3 php-soap php-zip php-ldap php-imap php-cas -y
Now download and unzip FreePBX.
# wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-17.0-latest.tgz
# tar -xvzf freepbx-17.0-latest.tgz
Now install and access the FreePBX folder; at this point, you can install FreePBX:
# cd freepbx
# ./install -n
You should get a result similar to:
Now you will need to replace the Apache user and enable the AllowOverride All option in Apache:
# sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
# sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
Then you will need to configure the maximum upload size in PHP:
# sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/*/apache2/php.ini
# sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/*/cli/php.ini
Now you can enable Apache2 and restart it to apply the changes.
# a2enmod rewrite && systemctl restart apache2
FreePBX Configuration
Access the address: http://your-server-ip/admin. Once accessed, you can enter the user and their corresponding email:
Done. You can now enjoy your server with FreePBX 17!
We hope this article has helped you. If you have any doubts about this or any other issue related to your servers on Clouding, write to us at soporte@clouding.io. We’re here to help! 😉