Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Asterisk on Ubuntu 20.04 - DesignLinux

May 26 2021
designlinux 0 Comments
How to Install Asterisk on Ubuntu 20.04

Asterisk is a popular open-source PBX platform for developing communications applications such as conference servers and VoIP gateways. It provides a set of features including, conference calling, call queuing, call recording, voicemail, music on hold, interactive voice response, SMS messaging, and more. In this tutorial we will show you how to install Asterisk on Ubuntu 20.04.

Ubuntu repositories include an older Asterisk version. We’ll install the latest Asterisk from the source code.

Perform the following steps to install Asterisk on your Ubuntu 20.04 system:

Step 1 – Install Packages#

Install the following packages that are necessary to download and build Asterisk:

You need to install following necessary packages:

sudo apt update
sudo apt install wget build-essential git autoconf subversion pkg-config libtool

Step 2 – Installing Asterisk on Ubuntu#

Now we download the latest version of Asterisk from the Asterisk official website using the following command:

cd /usr/src/
sudo git clone -b 18 https://gerrit.asterisk.org/asterisk asterisk-18

Currently, at the time of writing, the latest version of Asterisk is 18.x. Next, change the directory to the extracted directory. Before continuing with the next steps, change to the Asterisk source directory:

cd asterisk-18/

Download the MP3 sources which are required to build the MP3 module and use MP3 files on Asterisk:

sudo contrib/scripts/get_mp3_source.sh

After that, install other dependencies with the following command:

sudo contrib/scripts/install_prereq install

It will show you a success message as following :

#############################################
##    install completed successfully       ##
#############################################

The configure script performs several checks to make sure all of the dependencies on your system are present. Run the script by typing:

sudo ./configure

The next step is to select the modules you want to compile and install. Access menu selects, by typing:

sudo make menuselect

Select the “format_mp3” option to tell Asterisk to build the MP3 module:

asterisk-mp3

After that select the “Save and Exit” button and press “Enter” and start compilation process:

sudo make -j2

The compilation process may take some time depending on your system. You can modify the -j flag according to the number of cores in your processor.

Once completed, install and configuration Asterisk and its modules by following commands:

sudo make install
sudo make samples
sudo make basic-pbx
sudo make config
sudo ldconfig

Step 3 – Create an Asterisk User#

Asterisk runs as the root user by deafult. You need to create a new system user and configure Asterisk.

Run the following command to create a new system user named asterisk:

sudo adduser --system --group --home /var/lib/asterisk --no-create-home --gecos "Asterisk PBX" asterisk

To set default user to Asterisk, edit the /etc/default/asterisk file:

sudo nano /etc/default/asterisk

Uncomment the following lines:

AST_USER="asterisk"
AST_GROUP="asterisk"

Add the asterisk user to the dialout and audio groups:

sudo usermod -a -G dialout,audio asterisk

After that, you need to change the ownership and permissions of all asterisk files and directories so the user asterisk can access those files:

sudo chown -R asterisk: /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk
sudo chmod -R 750 /var/{lib,log,run,spool}/asterisk /usr/lib/asterisk /etc/asterisk

Step 4 – Starting Asterisk#

At this stage, all set ups are completed. Run the commands below to enable and start the Asterisk service:

sudo systemctl enable asterisk
sudo systemctl start asterisk

To verify that Asterisk is running, run the commands below:

sudo asterisk -vvvr

Step 5 – Configure Firewall#

If you have an active ufw firewall, open HTTP ports and ports 5060,5061:

If you don’t have a firewall configured on your server, you can check our guide about how to set up a firewall with ufw on ubuntu.

By default, SIP uses the UDP port 5060, to open the port run:

sudo ufw allow 5060/udp

If you enabled the Real Time Protocol (RTP) then you also need to open the following port range:

sudo ufw allow 10000:20000/udp

Conclusion#

Congratulations! You have successfully installed Asterisk. For additional help or useful information about, how to configure and use Asterisk check the official documentation.

Please leave a comment below if you have any problem or feedback.

Related

Tags: asterisk, ubuntu

10 Most Used Linux Distributions of All Time

Prev Post

How to Install Latest LXQt Desktop in Ubuntu and Fedora

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 259
  • 614,631

DesignLinux.com © All rights reserved

Go to mobile version