How to Install Asterisk on CentOS 7 Step by Step

Asterisk is the most popular and widely adopted open source PBX platform that powers IP PBX systems, conference servers and VoIP gateways. It is used by individuals, small businesses, large enterprises and governments worldwide. In this tutorial we will learn how to install Asterisk on CentOS 7 Step by Step.

Prerequisites

This tutorial assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root accge of Linount, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Asterisk on a CentOS 7 server.

Install Asterisk on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing Dependencies.

Install all required packages on your Asterisk with the following commands:

yum groupinstall core base "Development Tools"

Step 3. Disable SELinux on CentOS 7.

To disable SELinux security features, open the /etc/selinux/config file and set SELINUX=disabled:

sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

Step 3. Installing Asterisk on CentOS 7.

First, download the latest version of Asterisk:

cd /usr/src/
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15-current.tar.gz
tar zxf asterisk-15-current.tar.gz

Once the asterisk archive is extracted, change to the asterisk-15.5.0 directory with the following command:

cd asterisk-15.*/

Next, install Asterisk dependencies:

sudo contrib/scripts/get_mp3_source.sh
sudo contrib/scripts/install_prereq install

The script will install all necessary packages and upon successful completion, it will print the following message:

#############################################
##    install completed successfully.      ##
#############################################
1
2
3
	
#############################################
##    install completed successfully.      ##
#############################################

Then, install Asterisk using following command:

sudo ./configure --libdir=/usr/lib64

Upon successful completion, you will see 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$$$$$$  $$
     $$$$$$$$$$$$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 :
configure: host-cpu:vendor:os: x86_64 : pc : linux-gnu :

The next step is to select the modules you want to compile and install, most of the modules are already enabled. Access the Menuselect system, by typing:

make menuselect

Now that the configuration is completed start the compilation process using the make command:

make

Once the build process is completed, you will be presented with the following message:

+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running:              +
+                                           +
+             make install                  +
+-------------------------------------------+

As the message above says, the next step is to install Asterisk and its modules by typing:

make install

Once the installation is finished the script will display the following message:

+---- Asterisk Installation Complete -------+
 +                                           +
 +    YOU MUST READ THE SECURITY DOCUMENT    +
 +                                           +
 + 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  +
 +-------------------------------------------+

Run the make samples command to install the Asterisk sample configuration files:

make samples
make config
ldconfig

The last step is to enable Asterisk service to start on boot with:

systemctl start asterisk
systemctl enable asterisk
systemctl status asterisk

Congratulation’s! You have successfully installed Asterisk. Thanks for using this tutorial for installing Asterisk on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Asterisk web site.

Leave a Reply