Fazal
Fazal
Solution Architect. passionate about exploring, deploying, and writing about new technologies related to systems, networks, cloud, and microservices.

Install FreePBX and Asterisk on Ubuntu 22.04

- Advertisement -

Today you will learn how to install FreePBX and Asterisk on Ubuntu 22.04

Asterisk is an Open-Source VOIP server to facilitate business, and other organizations’ communication in terms of Voice calls, Voicemail, call recording, interactive voice response, and conferencing calling.

The system is managed through a web browser where we create

Prerequisites

OS: Ubuntu

Step 1: Install the OS

Step 2: Install the required dependencies

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

Step 3: Install Asterisk

$ wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-19-current.tar.gz
Note: Asterisk 19 is the latest version. check the latest version using this link $ wget http://downloads.asterisk.org/pub/telephony/asterisk/

Extract the download file

- Advertisement -
$ tar zxf asterisk-19-current.tar.gz

change the directory to the extracted directory

$ cd asterisk-19.*/
$ contrib/scripts/get_mp3_source.sh
$ contrib/scripts/install_prereq install

Configure Asterisk

$ ./configure

setup menu options

$ make menuselect

Enabe Add-on

Enable Core Sound Module

Enable Music On Hold file packages

Extra Sound Packages

Build Asterisk

$ make -j2

Install Asterisk

$ make install

Install config & sample

$ make samples
$ make config
$ ldconfig

Step 4: Configure further Asterisk option

Create user and group

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

add users to group

$ usermod -aG audio,dialout asterisk

Set permissions

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

To set the asterisk user as the default user, edit the file “/etc/default/asterisk” and uncomment the following

Edit Asterisk default configuration file as below

$ vi /etc/asterisk/asterisk.conf
Install FreePBX
:wq + enter
$ systemctl restart asterisk
$ systemctl enable asterisk
$ systemctl status asterisk

You will see some errors; run the following commands to remove that.

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

please submit the above second and third command in one line past in notepad and adjust in one line.

$ systemctl restart asterisk

connect the Asterisk

$ asterisk -rvv
$ exit

Step 5: Install FreePBX

Install the dependencies like PHP and MariaDB

$ apt-get install software-properties-common –y
$ add-apt-repository ppa:ondrej/php -y
$ apt-get install apache2 mariadb-server libapache2-mod-php7.2 php7.2 php-pear php7.2-cgi php7.2-
common php7.2-curl php7.2-mbstring php7.2-gd php7.2-mysql php7.2-bcmath php7.2-zip php7.2-
xml php7.2-imap php7.2-json php7.2-snmp
$ apt install mariadb-server
$ sudo add-apt-repository -y ppa:ondrej/php

$ apt-get update

$ sudo apt-get install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-curl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-intl php7.2-ldap php7.2-imagick php7.2-json php7.2-cli

Download FreePBX file

$ wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
$ tar -xvzf freepbx-15.0-latest.tgz

$ cd FreePBX

$ apt-get install nodejs -y
$ ./install -n

Change Apache user to asterisk and turn on the AllowOverride option.

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

Setup upload_max_filesize to php.ini

sed -i 's/(^upload_max_filesize = )./\120M/' /etc/php/7.2/apache2/php.ini 
sed -i 's/(^upload_max_filesize = )./\120M/' /etc/php/7.2/cli/php.ini

Enable APache rewrite module and restart the services

$ a2enmod rewrite
$systemctl restart apache2

Access FreePBX

http: yourserver ip/admin
Install FreePBX

Thanks !!!

I will create the following blog for creating extensions and calling.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook

x