CentOSLinuxTutorials

How to Install Asterisk on CentOS 7

Install Asterisk on CentOS 7

In this tutorial, we will show you how to install Asterisk on CentOS 7 server. For those of you who didn’t know, 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.

This article 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 account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you the step-by-step installation of Asterisk on a CentOS 7 server.

Prerequisites

  • A server running one of the following operating systems: CentOS 7.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

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.      ##
#############################################

Then, install Asterisk using the 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 the Asterisk service to start on boot with:

systemctl start asterisk
systemctl enable asterisk
systemctl status asterisk

Congratulations! 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 website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button