Asterisk tutorial: Install Asterisk 18 from source on CentOS Stream 8

Asterisk tutorial: Install Asterisk 18 from source on CentOS Stream 8

Asterisk is an open source platform for building communication applications. It supports IP PBX systems, VoIP gateways, conference servers and other custom solutions. This is not an ordinary curiosity or a toy for computer enthusiasts. This system is used by small businesses, large companies, call centers, carriers and government agencies around the world. Most importantly, Asterisk is free and open source software. Asterisk can become the basis of a complete VOiP telephony system in your company. It contains components that allow it to perform a wide range of functions.
  • Hosted PBX
  • IP PBX (Business Phone Systems)
  • VoIP Gateway
  • Voicemail server
  • Conference Bridge
  • Call center
  • IVR server
What’s more, this free Internet telephony system can be installed on a free Linux distribution: CentOS Stream 8

If you prefer a different Linux distribution, you can also see our articles about installing Asterisk on Debian, Ubuntu, CentOS 7 and Rocky 9. Click on one of these links to see how to install asterisk on other Linux systems

Table of Contents

Since Centos 7/8 approaches it’s EOL, below you’ll find all necessary commands and files to install Asterisk 18 from source on Centos 8 Stream.

Instead of following all the instructions below, you can also use our installer file that installs Asterisk 18 from source.



1) Prerequisites

First of all make sure that you run all command as root user. Just run su command and enter root password.


It’s good to start with installing a simple text editor. Personally I use nano. If you want to adjust it to editing Asterisk check out this post.

Update the system and install required dependencies.

					yum -y update
yum-y install nano wget tar ncurses-devel

2) SELinux

Before you start you should also disable SELinux (Security-Enhanced Linux – Linux kernel security module). Without doing so you’ll face issues later, eg. with recordings playback.

First let’s use sestatus command. It will show you current SELinux status:


To disable SELinux edit file /etc/selinux/config and change policy from enforcing to disabled.

					nano /etc/selinux/config

Alternatively to editing /etc/selinux/config you may just type in command:

					sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config

3) Reboot

Unfortunately reboot is the only way to permanently disable SELinux so let’s do just that.


If you do not want to restart the computer now, but want to go into ‘permissive’ mode, enter setenforce 0. This will allow you to continue without having to restart.

					setenforce 0

After reboot sestatus should show it’s disabled.

4) Configuring dependencies

First download Asterisk sources. /usr/src is a very convenient place to store all source files.

					cd /usr/src
tar zxvf asterisk-18-current.tar.gz
rm -rf asterisk-18-current.tar.gz
cd asterisk-18*/

Now (compared to eg. Asterisk 11) you don’t have to name all required dependencies (eg. make gcc gcc-c++ lynx bison ncurses-devel). You do all that with pre-created script. To be able to download more resources (like opus codec or spandsp for faxing) add EPEL repository first.

					yum -y install epel-release # optional
contrib/scripts/install_prereq install

Since CentOS Stream 8 required 64bit system we can just add --libdir=/usr/lib64 to configure command.

Since chan_pjsip requires some additional libraries you may want to add --with-jansson-bundled --with-pjproject-bundled to configure command.

Beginning with Asterisk 15.0.0, it is enabled by default but can be disabled with the --without-pjproject-bundled option to ./configure.

					./configure --libdir=/usr/lib64

After it finishes you’ll see “all-is-done” screen with Asterisk logo.

If you see “Please install the ‘libedit’ development package” error it means that you need to install libedit-devel package first. You may download it with PowerTools repo with command:

					dnf --enablerepo=powertools install -y libedit-devel

But then you need to run ./configure once again.

5) make, make, make and … make

Then you could just make and this would compile your software. But it’s better to be able to select some additional options, functions, applications, codecs, etc…..

To do that use make menuselect option. It will show you a menu in which you may simply select what you need.

					make menuselect

During the process you may check, switch, select and deselect all options eg. use ODBC instead FILE storage for Voicemail.

You’ll notice that you cannot select all modules. But it also shows which dependencies are required.

In this example if you download&install ikemel-devel rpm problem is solved. Of course you have to ./configure once again before menuselect.

Unfortunately there are so many modules it’s hard to explain all dependencies. For the sake of this tutorial we’ll stick to basic configuration. In upcoming posts we’ll be explaining addotional modules step-by-step.

If you want to deploy the same configuration in more server you may use one-line command menuselect/menuselect --enable-category MENUSELECT_ADDONS --disable MODULENAME --enable MODULENAME menuselect.makeopts. To list all possible options use menuselect/menuselect --list-options.

					# example with ODBC Voicemail and ALAW soundpack
make menuselect.makeopts
menuselect/menuselect --list-options
menuselect/menuselect --enable-category MENUSELECT_ADDONS --disable FILE_STORAGE --enable ODBC_STORAGE --disable CORE-SOUNDS-EN-GSM --enable CORE-SOUNDS-EN-ALAW --disable MOH-OPSOUND-WAV --enable MOH-OPSOUND-ALAW --enable EXTRA-SOUNDS-EN-ALAW menuselect.makeopts

Time to make everything and get ready to install. This and next process may take a few minutes.


The system tells you what to next. This will finally install Asterisk on your server.

					make install

If you selected format_mp3 just follow on-screen instructions.


Now you have a few options:

  • do nothing
    Yeap … it does completely nothing. You have to create all files from scratch.
  • make samples
    Installs the sample configuration files (overwriting any existing config files).
  • make progdocs
    Installs just program documentation usefulonly for developers (requires doxygen: yum -y install doxygen)
  • make basic-pbx (only Asterisk 13+)
    The best option but unavailable in our Asterisk version. Same as “make samples” but with only 14 necessary files instead of more than 100.

I encourage you to do both 2nd and 4th option. Let’s start with make samples. This will create all files with nice documentation.

					make samples

Then move them to new folder (eg. /etc/asterisk/samples/) and create basic config with make basic-pbx.

					mkdir /etc/asterisk/samples
mv /etc/asterisk/*.* /etc/asterisk/samples/
make basic-pbx

Although Asterisk is now ready (and surprisingly there is no informations about this on main screen) now you should do make config to create startup files and to make it easier to use basic commands.

					make config

6) Starting Asterisk

Now can start your server and check it’s status.

					systemctl start asterisk
systemctl status asterisk

If you see Started LSB: Asterisk PBX. You’ve just installed Asterisk!

You may also enter /etc/asterisk directory and see all of the basic files and sample/ folder

					cd /etc/asterisk

After that you may run asterisk -r and that’s where fun begins!

					asterisk -r


If you would like to monitor everything that is happening on your PBX, try our proprietary VOIPERO software.

Setup only takes a few minutes and the system is currently completely FREE.

Read what our VOIPERO system can do in terms of live monitoring and reporting of VoIP systems based on Asterisk.

Share this post

Do you have questions or you need an offer?

Contact us!

Most popular

Related Posts

We Have Launched

Monitoring & Reporting of Your VoIP Server