How to Install FreePBX on Ubuntu 22.04 / 23.04

How to Install FreePBX on Ubuntu 22.04 / 23.04. In this guide, we introduce FreePBX, its main features then show you how to install Asterisk and FreePBX on Ubuntu 22.04 / 23.04.

When compared to conventional hosted PBX systems, open source IP PBX provides more scalability, decreased expenses, and customization options.

The FreePBX Ecosystem creates robust communication solutions that is simple to maintain and execute. 

IP PBX is software based rather than hardware based.  Allows for an infinite number of extensions per user and it uses a single network for the transmission of voice, video, data, and other types of information.

Let’s start with How to Install FreePBX on Ubuntu 22.04 / 23.04.

What is FreePBX?

Importantly, FreePBX is an open source IP PBX administration tool developed by Sangoma Technologies. It provides customers with a wide variety of options for tailoring their corporate phone system, both in terms of pre installed functionality and additional modules.

It has certain standard functions already implemented, but its main appeal is that it is customizable to meet your business’s precise requirements.

Features of FreePBX

  • Notifications of available security updates provide continued safety in the face of evolving threats.
  • Add famous features like high availability, call centre packages, IP phones, and a lot more by just signing in to the store and selecting the item.
  • The full featured web GUI makes it much easier to use tools like a calendar interface, IVRs, restore and backup, user rights, extension creation, time conditions, and a firewall. The web user interface may also be used to do updates.
  • Users customize the end point device’s local language support to their own needs. Set up as many individual extensions, users, queues, and interactive voice response systems (IVRs).
  • The code is freely available to anybody that facilitates communication between businesses.
  • Changing or adding plugins is very easy and quick.
  • Interactive digital menus for the front desk is made using this tool.
  • With FreePBX is easy to restore backups.
  • Check out your phone logs by using the ARI in Asterisk
  • The recorded chats are saved for later listening.
  • FreePBX allows users to add their own music while on hold.
  • The calls may be redirected depending on time of day or other criteria.
  • Compatible with all trunk technologies currently supported by Asterisk.

How to Install FreePBX on Ubuntu 22.04 / 23.04

In this section, firstly we show the Asterisk installation procedure. After that we guide you on how to install FreePBX on Ubuntu 22.04 / 23.04.

Prerequisites

  • An Ubuntu 22.04 / 23.04 server installed on your system.
  • A root user or a user with sudo privileges.

Install Required Dependencies

Before starting, update all the system packages to the updated version. Update all of them using the following command.

				
					apt update -y
apt upgrade -y
				
			

Once all the packages are upgraded, you also need to install some dependencies required for Asterisk. Install all those dependencies using the following command.

				
					apt-get install unzip git gnupg2 curl libedit-dev libnewt-dev libssl-dev libncurses5-dev subversion libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev subversion -y
				
			

Once all the dependencies are installed, proceed to the next step.

Install Asterisk Server

By default, the Asterisk package is not included in the Ubuntu default repository. So compile it from the source. First, download the latest version of Asterisk using the following command.

				
					wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz
				
			

Once the Asterisk is downloaded, extract the downloaded file with the following command.

				
					tar -xvzf asterisk-20-current.tar.gz
				
			

Next, navigate inside the Asterisk directory and required all prerequisites packages using the following command.

				
					cd asterisk-20.2.1
contrib/scripts/get_mp3_source.sh
contrib/scripts/install_prereq install
				
			

Next, configure the Asterisk server with the following command.

				
					./configure
				
			

Once the asterisk is configured, you get the following screen.

Next, run the following command to install additional modules.

				
					make menuselect
				
			

You should see the addon selection screen.

Then, again use the Arrow key to select and enable the music on hold module.

Next, use the Arrow to select and enable the extra sound module as shown below.

Once you are done, click on Save & Exit button to apply the changes. Then, run the following command to build the Asterisk server.

				
					make -j2
				
			

Finally, install the Asterisk with the following command.

				
					make install
				
			

This installs the Asterisk server on your system as shown below.

You also need to run the following commands to install samples and configuration files.

				
					make samples
make config
ldconfig
				
			

Configure Asterisk Server

First, create a dedicated user and group for Asterisk using the following command.

				
					groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
				
			

Next, add the Asterisk user to audio and dial out group.

				
					usermod -aG audio,dialout asterisk
				
			

Then, set the required permission on Asterisk directories.

				
					chown -R asterisk.asterisk /etc/asterisk
chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
chown -R asterisk.asterisk /usr/lib/asterisk
				
			

Next, edit the Asterisk configuration file with the following command.

				
					nano /etc/default/asterisk
				
			

Change the following line to match your Asterisk user and group.

				
					AST_USER="asterisk"
AST_GROUP="asterisk"
				
			

Save and close the file then edit the Asterisk main 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 to implement the changes.

				
					systemctl restart asterisk
				
			

To check the Asterisk status, run the following command.

				
					systemctl status asterisk
				
			

You should see the following output.

				
					● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Mon 2023-05-22 08:39:29 UTC; 6s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 52048 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
      Tasks: 74 (limit: 4579)
     Memory: 37.4M
        CPU: 989ms
     CGroup: /system.slice/asterisk.service
             └─52064 /usr/sbin/asterisk -U asterisk -G asterisk

May 22 08:39:28 ubuntu2204 systemd[1]: Starting LSB: Asterisk PBX...
May 22 08:39:29 ubuntu2204 asterisk[52048]:  * Starting Asterisk PBX: asterisk
May 22 08:39:29 ubuntu2204 asterisk[52048]:    ...done.
May 22 08:39:29 ubuntu2204 systemd[1]: Started LSB: Asterisk PBX.

				
			

At this point, Asterisk server is installed and configured on your server. Now, its time to verify it. Run the following command to connect to the Asterisk console.

				
					asterisk -rvv
				
			

If everything is fine, you will get into the Asterisk console as shown below.

Run the following command to exit from the Asterisk console.

				
					exit
				
			

Install LAMP Server

Next, you need to install the Apache, MariaDB and PHP to your server. First, add the PHP repository with the following command.

				
					apt install software-properties-common –y
add-apt-repository ppa:ondrej/php -y
				
			

Then, install the Apache, MariaDB, PHP and other required packages with the following command.

				
					apt install 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-snmp
				
			

Once all the packages are installed, start and enable the Apache and MariaDB service using the following command.

				
					systemctl start apache2 mariadb
systemctl enable apache2 mariadb
				
			

Install FreePBX Server

First, visit the FreePBX official website, pick the latest version of FreePBX then download it using the wget command as shown below.

				
					wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-16.0-latest.tgz
				
			

Once the FreePBX is downloaded, extract it using the following command.

				
					tar -xvzf freepbx-16.0-latest.tgz
				
			

Next, navigate to the extracted directory and install Node.js, and NPM with the following command.

				
					cd freepbx
apt-get install nodejs npm -y
				
			

Then, run the following command to set required permissions.

				
					./install -n
				
			

After that, install the PM2 module with the following command.

				
					fwconsole ma install pm2
				
			

Next, change the Apache configuration file with the following command.

				
					sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
				
			

Then, set max upload file size limit in PHP with the following command.

				
					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.ini
				
			

Next, enable the Apache rewrite module using the following command.

				
					a2enmod rewrite
				
			

Finally, restart the Apache service to implement the configuration changes.

				
					systemctl restart apache2
				
			

Access FreePBX Web Interface

At this point, FreePBX is installed and configured on your server. Now, open your web browser and access the FreePBX web interface using the URL http://freepbx-server-ip/admin. See the FreePBX initial setup screen.

Define your username, password, email, other configuration then click on the Setup System. See the following screen.

Click on the FreePBX Administration. You are redirected to the FreePBX login screen:

Type your administrator username, password then click Continue. After the successful login, you should see the FreePBX dashboard on the following screen.

Thank you for reading the article How to Install FreePBX on Ubuntu 22.04 / 23.04. We shall conclude. 

How to Install FreePBX on Ubuntu 22.04 / 23.04 Conclusion

In this post, we showed you Asterisk installation procedure. After that, we guided you on steps how to install the FreePBX server with Apache on Ubuntu 22.04 / 23.04. Start configuring Asterisk server via FreePBX GUI and make a call from via any voip client.

Businesses may save a ton of money and boost internal and external communication with a PBX framework developed using open-source software. The correct hardware also makes it simple to install modules that provide additional web connected features, such as call recording to improve customer service quality, video conferencing, and many more.

Avatar for Hitesh Jethva
Hitesh Jethva

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.

5 2 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x