FreePBX is an open-source web graphical user interface for controlling and managing Asterisk.
In this article, we explain how to install FreePBX on Ubuntu 20.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 to install Asterisk:
# apt install unzip git gnupg2 curl libnewt-dev libssl-dev libncurses5-dev libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev subversion -yInstalling Asterisk
Download the Asterisk package and extract it:
# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
# tar zxf asterisk-18-current.tar.gzNow go to the directory and install the required dependencies:
# cd asterisk-18.*/
# contrib/scripts/get_mp3_source.sh
# contrib/scripts/install_prereq installDuring installation, you will be asked for the country calling code:
Now you will need to configure Asterisk:
# ./configure
# make menuselectOnce you run the commands above, a tab will appear with the required add-ons (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
# ldconfigAsterisk configuration:
Now you need to create a user and group for Asterisk, then add the user to the appropriate group:
# groupadd asterisk
# useradd -r -d /var/lib/asterisk -g asterisk asterisk
# usermod -aG audio,dialout asteriskAssign 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/asteriskNow open the /etc/default/asterisk file and set 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 Try the above first; otherwise, check whether it works, or you can do it manually:
# nano /etc/default/asteriskAST_USER="asterisk"
AST_GROUP="asterisk"Now open the /etc/asterisk/asterisk.conf file 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 Try the above first; otherwise, check whether it works, or you can do it manually:
# nano /etc/asterisk/asterisk.conf
runuser = asterisk
rungroup = asteriskRestart Asterisk:
# systemctl restart asteriskAt this point, if you check the status:
# systemctl status asteriskYou will see the following error:
radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/radiusclient.conf: No such file or directoryTo 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.confNow, if you restart the service and check the status, everything should be fine:
# systemctl restart asterisk
# systemctl status asteriskFinally, connect to the command line using the command:
# asterisk -vvvrTo exit the CLI, use:
# exitInstalling FreePBX
Install nodejs, mariadb, apache2 and php so you can install FreePBX:
# apt install nodejs apache2 mariadb-server libapache2-mod-php7.4 php7.4 php-pear php7.4-cgi php7.4-common php7.4-curl php7.4-mbstring php7.4-gd php7.4-mysql php7.4-bcmath php7.4-zip php7.4-xml php7.4-imap php7.4-json php7.4-snmpNow download and extract FreePBX.
# wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-16.0-latest.tgz
# tar -xvzf freepbx-16.0-latest.tgzNow install and go to the freepbx folder; at this point, you can install FreePBX:
# cd freepbx
# ./install -nYou 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.confThen you will need to configure the maximum upload size in PHP:
# sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini
# sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/cli/php.iniYou can now enable apache2 and restart it to apply the changes.
# a2enmod rewrite && systemctl restart apache2FreePBX configuration
Go to the address: http://your-server-ip/admin where you can enter the administrator username and its corresponding email address:
Done. You can now enjoy your server with FreePBX 16!
We hope this article has helped you. If you still have questions about this or any other issue related to your servers on Clouding, write to us at soporte@clouding.io. We're here to help! 😉