Share on Social Media

Asterisk is software implementation of Personal Branch Exchange (PBX). In this guide, you will learn how to install Asterisk on CentOS 8. #centlinux #linux #asterisk

What is PBX? :

PBX is a telephone exchange or switching system that serves a private organization and permits sharing of central office trunks between internally installed telephones, and provides intercommunication between those internal telephones within the organization without the use of external lines. The central office lines provide connections to the public switched telephone network (PSTN) and the concentration aspect of a PBX permits the shared use of these lines between all stations in the organization. Its intercommunication ability allows two or more stations to directly connect while not using the public switched telephone network. This method reduces the number of lines needed from the organization to the public switched telephone network.

What is Asterisk PBX? :

Asterisk is a software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, it is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing.

Asterisk was created in 1999 by Mark Spencer of Digium, which since 2018 is a division of Sangoma Technologies Corporation. Originally designed for Linux, Asterisk runs on a variety of operating systems, including NetBSD, OpenBSD, FreeBSD, macOS, and Solaris, and can be installed in embedded systems based on OpenWrt (Open Wireless Router). (Source: Wikipedia)

Asterisk PBX is available in Community and Commercial editions. Community edition is a free software and distributed under GPLv2 license. Whereas, Commercial edition provides enterprise features but have a licensing cost.

Asterisk Features:

Some popular features of Asterisk are.

  • Voice over IP (VoIP)
  • Voice Mail
  • Conference Calling
  • Interactive Voice Response (Phone Menus)
  • Automatic Call Distribution
  • Supports common VoIP, ISDN protocols

Complete list of Asterix PBX features is available on their official website.

Environment Specification:

We are using a minimal CentOS 8 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – CentOS 8.2
  • Hostname –
  • IP Address – /24

Update Linux Software Packages:

Connect with as Linux root user by using a ssh client.

By following the best practice, update your Linux operating system before installing Asterisk VoIP software.

Use dnf command to update software packages of your Linux server.

# dnf update -y
Last metadata expiration check: 0:00:30 ago on Wed 25 Nov 2020 08:24:39 PM PKT.
Dependencies resolved.
Nothing to do.

All packages in our Linux operating system are already up-to-date.

Check Kernel version of your Linux server.

# uname -r

Check Linux operating system version.

# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

Download Asterisk VoIP Software:

Asterisk is a free software and you can download it from Asterisk official website or GitHub Repository.

Open Asterisk website in a web browser and copy the URL of the software setup. Currently version 18 is the latest version, and it is available for download.

Download Asterisk VoIP Software

Use wget command to download the software installer from the copied URL.

# wget
--2020-11-25 20:55:00--
Resolving (, 2001:470:e0d4::ee
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27886299 (27M) [application/x-gzip]
Saving to: âasterisk-18-current.tar.gzâ

asterisk-18-current 100%[===================>]  26.59M   949 B/s    in 82s

2020-11-25 20:56:24 (331 KB/s) - âasterisk-18-current.tar.gzâ saved [27886299/27886299]

Extract the downloaded tarball by using tar command.

# tar xf asterisk-18-current.tar.gz

Install Asterisk Prerequisites:

Asterisk VoIP software comes with a well written script that can be used to install prerequisite software packages on Linux servers.

Execute this script and install all prerequisite packages in one go.

# cd asterisk-18.1.0/contrib/scripts/
# ./install_prereq install
Install Asterisk Prerequisites 1

To enable mp3 support for playing music while the client is on hold, you are required to install a few more dependencies. Luckily, the installer provides a script for the same. Execute it now.

# ./
Asterisk Enable Mp3 Support

Asterisk VoIP server also required libedit and libedit-devel packages, that are not available in standard yum repositories. Therefore, you have to install these packages from rpmfind website as follows.

# cd ~/asterisk-18.1.0
# dnf install -y /
> /
Install Asterisk Prerequisites 2

All prerequisites have been installed successfully.

Install Asterisk on CentOS 8:

Now, you can start setup of PBX software from extracted directory.

# ./configure --libdir=/usr/lib64 --with-jansson-bundled
Install Asterisk on CentOS 8 1

The next step in the build process is to tell Asterisk installer, which modules to compile and install, as well as set various compiler options. These settings are all controlled via a menu-driven system called Menuselect. To access the Menuselect system, execute the following command.

# make menuselect
Install Asterisk on CentOS 8 2
Asterisk Module and Build Option Selection

Select the required addons/modules that you want to install with the PBX server.

Compile and build the Asterisk VoIP software based on the above configurations.

# make
Building Documentation For: third-party channels pbx apps codecs formats cdr cel bridges funcs tests main res addons
 +--------- Asterisk Build Complete ---------+
 + Asterisk has successfully been built, and +
 + can be installed by running:              +
 +                                           +
 +                make install               +

Install the Asterisk VoIP software on your Linux server.

# make install
 +---- Asterisk Installation Complete -------+
 +                                           +
 +                                           +
 + 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                         +
 +                                           +
 +                                           +
 +-----------------  or ---------------------+
 +                                           +
 + You can go ahead and install the asterisk +
 + program documentation now or later run:   +
 +                                           +
 +               make progdocs               +
 +                                           +
 + **Note** This requires that you have      +
 + doxygen installed on your local system    +

Install Asterisk sample configuration files as follows.

# make samples
Install Asterisk sample configuration files 1

Install Asterisk sample files to configure basic PBX.

# make basic-pbx
Install Asterisk sample configuration files 2

Create OS User for VoIP Software:

Create OS user and group to own VoIP software directory.

# groupadd asterisk
# useradd -r -d /var/lib/asterisk -g asterisk asterisk
# usermod -aG audio,dialout asterisk

Change owner to asterisk user of following directories.

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

Edit following configuration file by using vim text editor.

# vi /etc/sysconfig/asterisk

And add following configurations therein to set default user for VoIP software.


Edit asterisk.conf file in vim text editor.

# vi /etc/asterisk/asterisk.conf

And add following directives to set default user to own Asterisk processes.

runuser = asterisk ; The user to run as.
rungroup = asterisk ; The group to run as.

Enable and start Asterisk service.

# systemctl enable --now asterisk

Check the status of asterisk.service.

# systemctl status asterisk.service
Check the status of asterisk.service

Accessing Asterisk CLI:

Connect to Asterisk CLI by using following command.

# asterisk -r
Asterisk 18.1.0, Copyright (C) 1999 - 2018, Digium, Inc. 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.1.0 currently running on asterisk-pbx (pid = 2350)

Let’s execute some common commands on Asterisk CLI.

asterisk-pbx*CLI> core show channels
Channel              Location             State   Application(Data)
0 active channels
0 active calls
0 calls processed
asterisk-pbx*CLI> core show uptime
System uptime: 1 hour, 29 minutes, 59 seconds
Last reload: 1 hour, 29 minutes, 59 seconds
asterisk-pbx*CLI> quit
Asterisk cleanly ending (0).
Executing last minute cleanups

Asterisk VoIP server has been installed on Linux operating system and working fine.

Conclusion – Install Asterisk on CentOS 8:

In this guide, you have learned how to install Asterisk on CentOS 8. To configure Asterisk as a PBX for your corporate environment, you might read Asterisk: The Definitive Guide: Open Source Telephony for the Enterprise (PAID LINK) by O’Reilly Media.

Leave a Reply

Your email address will not be published. Required fields are marked *