Setting Up the Basic Asterisk Server on Centos7/ RHEL7

Configure Basic Asterisk Server

Asterisk is an open source framework for making communications applications. Asterisk turns an ordinary computer into a communications server.

Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions.

It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide.

Steps for How to configure basic Asterisk Server:

1)Install and download the prerequisites packages.

Install the Package using yum command. If you are not configured the YUM server, refer the link(PART2: YUM (Yellowdog Updater Modified))

#yum -y install make wget openssl-devel ncurses-devel subversion newt newt-static newt-devel libxml2-devel kernel-devel gcc gcc-c++ mysql sqlite-devel uuid-devellibuuid-devel speex-devel libuuid libxslt uriparser

Now,  Need to install “jansson” Package which required by Asterisk Server.

#cd /usr/src/
#tar -xvf jansson-2.10.tar.gz
#cd jansson-2.10
#make && make install && make check

Sample Output:

. . . . . . . 

make[3]: Entering directory `/usr/src/jansson-2.10/test'
make[4]: Entering directory `/usr/src/jansson-2.10/test'
PASS: run-suites
Testsuite summary for jansson 2.10
# TOTAL: 1
# PASS: 1
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
make[4]: Leaving directory `/usr/src/jansson-2.10/test'
make[3]: Leaving directory `/usr/src/jansson-2.10/test'
make[2]: Leaving directory `/usr/src/jansson-2.10/test'
make[1]: Leaving directory `/usr/src/jansson-2.10/test'
make[1]: Entering directory `/usr/src/jansson-2.10'
make[1]: Leaving directory `/usr/src/jansson-2.10'

The above output shows Once you install the “jansson” package.

Now Download the Libpri, DAHDi and asterisk Package.

#mkdir -p /usr/src/asterisk
#cd /usr/src/asterisk

Similar download the “dahdi”  and “libri” Packages.


Configure the DAHDI software, DAHDI stands for Digium Asterisk Hardware Device Interface.

#tar -xvf dahdi-linux-complete-current.tar.gz
#cd dahdi-linux-complete-2.11.1+2.11.1/
#make install
#make config

Now Install the  “lipbri” software which is used for connecting to a PRI service.

#tar -xvf libpri-current.tar.gz
#cd libpri-1.6.0
#make install

Last we have to install the asterisk  software, refer below steps:

#cd /usr/src/asterisk
#tar -xvf asterisk-14-current.tar.gz
#cd asterisk-14.5.0
#./configure --libdir=/usr/lib64

Sample 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 :
configure: host-cpu:vendor:os: x86_64 : pc : linux-gnu :

Note: If you are using 32-bit OS then there are not need to gives library directory (I.e –libdir).Now, Execute below command;

#make menuselect && make && make install && make samples && make config

Sample Output:

. . . . . .
Installing file configs/samples/udptl.conf.sample
Installing file configs/samples/unistim.conf.sample
Installing file configs/samples/users.conf.sample
Installing file configs/samples/voicemail.conf.sample
Installing file configs/samples/vpb.conf.sample
Installing file configs/samples/xmpp.conf.sample
Updating asterisk.conf
/usr/bin/install -c -d "/var/spool/asterisk/voicemail/default/1234/INBOX"
build_tools/make_sample_voicemail "//var/lib/asterisk" "//var/spool/asterisk"
Installing file phoneprov/000000000000.cfg
Installing file phoneprov/000000000000-directory.xml
Installing file phoneprov/000000000000-phone.cfg
Installing file phoneprov/polycom_line.xml
Installing file phoneprov/polycom.xml
Installing file phoneprov/snom-mac.xml

2) Start and enable the asterisk service.

# /etc/init.d/asterisk start
Starting asterisk (via systemctl):                        [  OK  ]
# /etc/init.d/asterisk status
● asterisk.service - LSB: Asterisk PBX
   Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
   Active: active (running) since Thu 2017-06-01 03:11:00 EDT; 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 16068 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
 Main PID: 16093
   CGroup: /system.slice/asterisk.service
           ├─16091 /bin/sh /usr/sbin/safe_asterisk
           └─16096 sleep 4

Jun 01 03:10:59 astserver systemd[1]: Starting LSB: Asterisk PBX...
Jun 01 03:10:59 astserver asterisk[16068]: Starting asterisk:
Jun 01 03:10:59 astserver systemd[1]: PID file /var/run/asterisk/ not readable (yet?) after start.
Jun 01 03:11:00 astserver systemd[1]: asterisk.service: Supervising process 16093 which is not our child. We'll most likely not notice when it exits.
Jun 01 03:11:00 astserver systemd[1]: Started LSB: Asterisk PBX.
# /sbin/chkconfig asterisk on
# chkconfig --list | grep asterisk

3) Connect to Asterisk CLI.

Run the following command to connect to the Asterisk CLI.

#  asterisk -rvvvv
Asterisk 14.5.0, Copyright (C) 1999 - 2016, Digium, Inc. and others.
Created by Mark Spencer <>
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.
Connected to Asterisk 14.5.0 currently running on astserver (pid = 2491)

Note: If you got below error, then you have set SELINUX= disabled.

#  asterisk -rv
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)

To Uninstall the asterisk,refer below command;

#cd /usr/src/asterisk/asterisk-14.5.0
#make uninstall
#make uninstall-all
#make clean

Hope this post will help Linux/Unix beginners. Please share you feedback and Comments. Stay tune for more updates with …!!!

Leave a Reply


This site uses Akismet to reduce spam. Learn how your comment data is processed.

Notify of