How to Install Asterisk on CentOS 7 Step by Step

Install Asterisk on CentOS 7

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.

How to Install Asterisk (Usage Survey) on Ubuntu 18.04 LTS

Install Asterisk on Ubuntu 18

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 through the step by step installation Asterisk on an Ubuntu 18.04 Bionic Beaver server.

Install Asterisk on Ubuntu 18.04 LTS

Step 1. First make sure that all your system packages are up-to-date

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Dependencies.

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

apt-get install build-essential
apt-get install git-core subversion libjansson-dev sqlite autoconf automake libxml2-dev libncurses5-dev libtool

Step 3. Installing Asterisk on Ubuntu 18.04 LTS.

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

Next step is to run the ./configure script which will check your system for missing libraries and binaries and prepare the Asterisk source code for the build process:

./configure

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 :

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
make install-logrotate

You will see the following output indicating that the logrotation configuration has been successfully created:

if [ ! -d "/etc/asterisk/../logrotate.d" ]; then \
        /usr/bin/install -c -d "/etc/asterisk/../logrotate.d" ; \
fi
sed 's#__LOGDIR__#/var/log/asterisk#g' < contrib/scripts/asterisk.logrotate | sed 's#__SBINDIR__#/usr/sbin#g' > contrib/scripts/asterisk.logrotate.tmp
/usr/bin/install -c -m 0644 contrib/scripts/asterisk.logrotate.tmp "/etc/asterisk/../logrotate.d/asterisk"
rm -f contrib/scripts/asterisk.logrotate.

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 your Ubuntu 18.04 LTS Bionic Beaver. For additional help or useful information, we recommend you to check the official Asterisk web site.