Install Asterisk 18 LTS on CentOS 8. RHEL 8

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose

Asterisk is a free-to-use, open source, and powerful communication system that can provide support for many IP PBX systems, VoIP gateways, and conference servers used in many SMBs, enterprises, call centers, operators and government agencies around the world. Installing Asterisk Server is the first step in implementing affordable, reliable and highly available PBX and VoIP systems.

In today’s guide, we will introduce the installation and configuration of Asterisk 18 LTS on CentOS 8. RHEL 8. Asterisk 18.0 It has been released for production use and can be downloaded. This is the LTS release, which means it will be supported for several years. If you are using an earlier version of Asterisk, such as 16 LTS or 17.x, this is the right time to plan an upgrade.

Functions of Asterisk PBX system

  • telephone conference
  • Call Recording
  • Call monitoring
  • Distributed universal number discovery
  • Caller ID in call waiting
  • Go directly to the system
  • Call park
  • SMS service
  • Trunking
  • Transcoding
  • Automatic attendant
  • Voicemail
  • Keep music
  • Transfer music
  • verification method
  • blacklist
  • Alarm receiver
  • Call queue and many other functions.

Install Asterisk 18 LTS on CentOS 8. RHEL 8

In the next part, we will walk you through the process of installing Asterisk 18 LTS on CentOS 8. RHEL 8 system. Assume that you are performing tasks on a newly configured CentOS 8 / RHEL 8 server. It is recommended to ensure that you do not break the dependencies of any running applications.

Step 1: Update the system and set the time zone

Before starting to install Asterisk, please make sure the system is updated.

sudo yum -y update

After the system is updated, please reboot.

sudo systemctl reboot

Wait for the server to restart, and then set the correct hostname.

sudo hostnamectl set-hostname

Also update the time zone.

sudo timedatectl set-timezone Africa/Nairobi

In addition, set SELinux to permissive mode by running the following command:

sudo setenforce 0sudo sed -i 's/(^SELINUX=).*/SELINUX=permissive/' /etc/selinux/config

Step 2: Add EPEL repository

Add the EPEL repository to your CentOS 8 | RHEL 8 server may contain the packages required by deps.

CentOS 8:

sudo yum -y install epel-release
sudo yum config-manager --set-enabled PowerTools


sudo yum -y install
ARCH=$( /bin/arch )
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms

Step 3: Install development tools

Install all the development tools needed to build Asterisk 18 on CentOS 8. RHEL 8 comes from the source code.

sudo yum group -y install "Development Tools"
sudo yum -y install git wget vim  net-tools sqlite-devel psmisc ncurses-devel libtermcap-devel newt-devel libxml2-devel libtiff-devel gtk2-devel libtool libuuid-devel subversion kernel-devel kernel-devel-$(uname -r) crontabs cronie-anacron libedit libedit-devel

Step 4: Download and install Jansson

We will also install Jansson, which is a C library for media data encoding and decoding.

git clone
cd jansson
autoreconf -i
./configure --prefix=/usr/
sudo make install

Step 5: Download and install PJSIP

PJSIP is a powerful multimedia communication library written in C language. It is used to implement standards-based protocols such as SIP, SDP, RTP, STUN, TURN and ICE.

Build PJSIP from source code by running the following command in the terminal.

cd ~
git clone
cd pjproject
./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr
make dep
sudo make install
sudo ldconfig

Step 6: Download and install Asterisk

Now that we have installed all the dependency packages, we should be ready to download and install Asterisk 15 on CentOS/RHEL 8.

cd ~
tar xvfz asterisk-18-current.tar.gz
cd asterisk-18*/

Install the libedit package.

sudo dnf -y install dnf -y install

Configure the asterisk.

./configure --libdir=/usr/lib64

A successful configuration should print the following output.

configure: Menuselect build configuration successfully completed

            .$7$7..          .7$$7:.    
          .$$:.                 ,$7.7   
        .$7.     7$$$$           .$$77  
     ..$$.       $$$$$            .$$$7 
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
 .777.   .$$$$$$77$$$77$$$$$7.      $$$,
 $$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7 
$$$       .7$$$$$$$$$$$$$$$$      :$$$. 
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.  
$$$        $$$   7$$$7  .$$$    .$$$.   
$$$$             $$$$7         .$$$.    
7$$$7            7$$$$        7$$$      
 $$$$$                        $$$       
  $$$$7.                       $$  (TM)     
   $$$$$$$.           .7$$$$$$  $$      

configure: Package configured for: 
configure: OS type  : linux-gnu
configure: Host CPU : x86_64
configure: build-cpu:vendor:os: x86_64 : pc : linux-gnu :

Step 7: Set the star menu option

Set the menu options by running the following command:

make menuselect

Use the arrow keys to navigate, then enter Key to select.

1. under Add-on select chan_ooh323 with format_mp3 As follows

2. On the “Core Sound Package”, select the format of the audio data package, as shown below

Install Asterisk ubuntu 18.04 02 minutes

3. For “Music on Hold”, please select the smallest module below

Install Asterisk ubuntu 18.04 03 minutes

5. On the “Extra Sound Pack”, select as follows:

Install asterisk ubuntu 18.04 04 minutes

6. Enable app_macro Under the “Applications” section.

Asterisk enables application macro menu

Then feel free to modify other settings to meet your needs Save and exit When finished.

Step 8: Build and install Asterisk

Run the following command to download the mp3 decoder library to the source code tree.


Build and install Asterisk on CentOS 8. RHEL 8:

sudo make install
sudo make samples
sudo make config
sudo ldconfig

Step 9: Configure and start Asterisk

Create a separate user and group to run the Asterisk service, and assign the correct permissions:

sudo groupadd asterisksudo useradd -r -d /var/lib/asterisk -g asterisk asterisksudo usermod -aG audio,dialout asterisksudo chown -R asterisk.asterisk /etc/asterisk /var/{lib,log,spool}/asterisk /usr/lib64/asterisk

Set Asterisk default user to Asterisk:

$ sudo vim /etc/sysconfig/asteriskAST_USER="asterisk"AST_GROUP="asterisk"$ sudo vim /etc/asterisk/asterisk.confrunuser = asterisk ; The user to run as.rungroup = asterisk ; The group to run as.

After saving the changes in the configuration file, restart the Asterisk service.

sudo systemctl restart asterisk

The service can be enabled after restarting the server.

sudo systemctl enable asterisk

Use the following command to confirm the service status:

$ systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/rc.d/init.d/asterisk; generated)
   Active: active (running) since Mon 2021-01-11 19:00:39 EAT; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 107586 ExecStop=/etc/rc.d/init.d/asterisk stop (code=exited, status=0/SUCCESS)
  Process: 107616 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
 Main PID: 107650 (asterisk)
    Tasks: 84 (limit: 4763)
   Memory: 68.7M
   CGroup: /system.slice/asterisk.service
           ├─107648 /bin/sh /usr/sbin/safe_asterisk
           └─107650 /usr/sbin/asterisk -f -vvvg -c

Jan 11 19:00:39 systemd[1]: asterisk.service: Succeeded.
Jan 11 19:00:39 systemd[1]: Stopped LSB: Asterisk PBX.
Jan 11 19:00:39 systemd[1]: Starting LSB: Asterisk PBX...
Jan 11 19:00:39 asterisk[107616]: Starting asterisk:
Jan 11 19:00:39 systemd[1]: Started LSB: Asterisk PBX.

Use the asterisk command to test to confirm whether the Asterisk CLI is operating normally:

[[email protected]]$ sudo asterisk -rvv
 Asterisk 18.1.1, Copyright (C) 1999 - 2018, Digium, Inc. and others.
 Created by Mark Spencer [email protected]
 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.1 currently running on asterisk (pid = 107650)

asterisk*CLI> core show channels
Channel              Location             State   Application(Data)             
0 active channels
0 active calls
0 calls processed

asterisk*CLI> core show  uptime 
System uptime: 2 minutes, 53 seconds
Last reload: 2 minutes, 53 seconds

asterisk*CLI> quit
Asterisk cleanly ending (0).
Executing last minute cleanups

Step 10: Install FreePBX

If you need a user interface-based Asterisk management dashboard, please check how to install FreePBX on RHEL/CentOS 8.

This marks the end of our article on installing Asterisk 18 LTS on CentOS 8. RHEL 8 Linux server. In our next article, we will study how to integrate Asterisk with other platforms to build creative and outstanding VoIP solutions.

How to protect Asterisk and FreePBX from VoIP fraud and Bruteforce attacks

You can download this article in PDF format via the link below to support us.Download the guide in PDF formatClose