How to Install FreePBX on Ubuntu 20.04 (Open Source PBX Tutorial). In this tutorial we will introduce what freePBX is and move onto installation steps with Apache, MariaDB and PHP packages to be installed on your server with Asterisk. Let’s get started.
What is FreePBX
FreePBX is a free, open source and web based user interface used for managing Asterisk “a voice over IP and telephony server” through the web browser. FreePBX is a web based open source GUI (graphical user interface) that controls Asterisk. FreePBX is VoIP Solution and a private telephone network that allows you to connect to public landlines and mobile networks. It provides audio, video, and instant messaging communication through the TCP/IP protocol and allows you to connect it with PSTN for telephony communication.
Asterisk is a free and open source implementation of a private branch exchange (PBX). It is used for managing telephone calls between telecommunication endpoint. Asterisk provides a terminal console to manage the PBX system. Managing and configuring Asterisk via command line is very difficult for any beginner. This is where the FreePBX server comes into the picture.
Follow this post to learn how to install FreePBX on Ubuntu 20.04.
Install FreePBX on Ubuntu 20.04 (Open Source PBX Tutorial)
Getting Started
Before starting, it is recommended to update all packages to the latest version. Open your command line interface and run the following command to update all the packages:
apt-get update -y
apt-get upgrade -y
Once all the packages are updated, you will also need to install some dependencies required for FreePBX. You can install all of them using the following command:
You can use the Arrow key to navigate and Enter key to select. First, enable the Addons as shown below:
Enable Core Sound Modules
In here please enable the core sound modules as shown below:
Enable MOH packages
In here enable the music on hold packages as shown below:
Enable Extra Sound Packages
Please enable the extra sound packages as shown below:
After selecting all required components, click on the Save & Exit button to close the console. Next, run the following command to build the Asterisk:
make -j2
You will get the following output:
+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running: +
+ +
+ make install +
+-------------------------------------------+
Next, install the Asterisk using the following command:
make install
You will get the following output:
+---- Asterisk Installation Complete -------+
+ +
+ YOU MUST READ THE SECURITY DOCUMENT +
+ +
+ Asterisk has successfully been installed. +
+ If you would like to install the sample +
+ configuration files (overwriting any +
+ existing config files), run: +
+ +
+ For generic reference documentation: +
+ make samples +
+ +
+ For a sample basic PBX: +
+ make basic-pbx +
+ +
+ +
Next, run the following commands to install samples and config:
After installing the Asterisk server, you will need to create a dedicated user and group to run Asterisk. You can create it with the following command:
Next, edit the Asterisk default configuration file:
nano /etc/default/asterisk
Change the following lines:
AST_USER="asterisk"
AST_GROUP="asterisk"
Save and close the file then edit the Asterisk configuration file:
nano /etc/asterisk/asterisk.conf
Change the following lines:
runuser = asterisk ; The user to run as.
rungroup = asterisk ; The group to run as.
Save and close the file then restart the Asterisk service:
systemctl restart asterisk
Next, verify the status of the Asterisk using the following command:
systemctl status asterisk
You will get the radcli error as shown below:
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk; generated)
Active: active (running) since Fri 2022-03-11 03:07:37 UTC; 10s ago
Docs: man:systemd-sysv-generator(8)
Process: 44796 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
Tasks: 81 (limit: 4686)
Memory: 46.1M
CGroup: /system.slice/asterisk.service
└─44826 /usr/sbin/asterisk -U asterisk -G asterisk
Mar 11 03:07:36 freepbx systemd[1]: Starting LSB: Asterisk PBX...
Mar 11 03:07:37 freepbx asterisk[44796]: * Starting Asterisk PBX: asterisk
Mar 11 03:07:37 freepbx asterisk[44796]: ...done.
Mar 11 03:07:37 freepbx systemd[1]: Started LSB: Asterisk PBX.
Mar 11 03:07:37 freepbx asterisk[44826]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/radiusclient.conf: No such f>
Mar 11 03:07:37 freepbx asterisk[44826]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/radiusclient.conf: No such f>
lines 1-16/16 (END)
To fix the above error, run the following commands:
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
Finally, restart the Asterisk service to apply the changes:
systemctl restart asterisk
Now, connect to the Asterisk console with the following command:
asterisk -rvv
You will get the Asterisk console as shown below:
Asterisk 18.10.1, Copyright (C) 1999 - 2021, Sangoma Technologies Corporation and others.
Created by Mark Spencer
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Running as user 'asterisk'
Running under group 'asterisk'
Connected to Asterisk 18.10.1 currently running on freepbx (pid = 44958)
freepbx*CLI>
Run the following command to exit from the console.
FreePBX requires the Apache server , MariaDB server, and PHP packages to be installed on your server. If not installed, follow the below steps to install them.
First, install all the dependencies using the following command:
apt-get install software-properties-common -y
Next, add the PHP repository with the following command:
add-apt-repository ppa:ondrej/php -y
Next, install the Apache, MariaDB, PHP and other required PHP extensions using the following command:
At this point, FreePBX is installed on Ubuntu 20.04 server. Now, open your web browser and access the FreePBX using the URL http://your-server-ip/admin. You should see the following screen:
Define your admin user, password and click on the SetupSystem button. You should see the following screen:
Click on the FreePBXAdministration. You should see the FreePBX login screen:
Provide your admin username, password, and click on the Continue button. You should see the FreePBX dashboard on the following screen:
Congratulations! you have successfully installed and configured FreePBX on Ubuntu 20.04 server. You can now add a DID (trunks), create extensions, inbound and outbound rules, call recordings, and more via the FreePBX web interface. I hope this post will help you manage your Asterisk server using FreePBX.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
55votes
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Please login to comment
2 Comments
Most Voted
NewestOldest
Inline Feedbacks
View all comments
Adolfo Arizpe
Guest
2 years ago
Great tutorial, thank you very much! You saved me lots of hours in trials and errors.
Just a note, not sure if it will be the case for everybody or if I missed something, but at the end of it all, I had to go back and run make menuselect again to add app_macro, run make -j2 and run make install again. Before that, my calls were failing with: No application ‘Macro’ for extension. After that, calls connect normally.
Last edited 2 years ago by Adolfo Arizpe
Thomas Carlisle
Member
1 year ago
A nice write-up, but one important omission error. During the asterisk build, in the ‘make menuselect’ step, you also have to specifically check ‘app_macro’ under the ‘Applications” category. Failing to do this, freepbx isn’t going to work. Well, it will work in that it will launch and the UI will work, but calling isn’t going to work.
Great tutorial, thank you very much! You saved me lots of hours in trials and errors.
Just a note, not sure if it will be the case for everybody or if I missed something, but at the end of it all, I had to go back and run make menuselect again to add app_macro, run make -j2 and run make install again. Before that, my calls were failing with: No application ‘Macro’ for extension. After that, calls connect normally.
A nice write-up, but one important omission error. During the asterisk build, in the ‘make menuselect’ step, you also have to specifically check ‘app_macro’ under the ‘Applications” category. Failing to do this, freepbx isn’t going to work. Well, it will work in that it will launch and the UI will work, but calling isn’t going to work.