Tuesday, October 11, 2016

Install asterisk on CentOS 6

How to install asterisk on CentOS 6. In this tutorial, the version of CentOS 6 is
# cat /etc/redhat-release 
CentOS release 6.4 (Final)
1. Update the environment
# yum install -y epel-release dmidecode gcc-c++ ncurses-devel libxml2-devel make wget openssl-devel newt-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel jansson-devel binutils-devel
2. Install pjproject
# cd /tmp
# wget http://www.pjsip.org/release/2.5.5/pjproject-2.5.5.tar.bz2
# tar -jxvf pjproject-2.5.5.tar.bz2
2.1 Compile pjproject
# cd pjproject-2.5.5
# ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --enable-shared --disable-video --disable-sound --disable-opencore-amr
NOTE: I am installing in an 32bit machine. If you are using 64bit machine, add --libdir=/usr/lib64
# make dep
# make 
# make install
# ldconfig
Verify the pjsip libraries have been dynamically linked
# ldconfig -p | grep pj
3. Install asterisk
# cd /tmp
#  wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/asterisk-certified-13.8-current.tar.gz
# tar -zxvf asterisk-certified-13.8-current.tar.gz 
# cd asterisk-certified-13.8-cert2
# ./configure
NOTE: If you are using 64bit machine, add --libdir=/usr/lib64 Error encountered
checking for json_dumps in -ljansson... no
configure: error: *** JSON support not found (this typically means the libjansson development package is missing)
#
To resolve, install jansson
# wget http://www.digip.org/jansson/releases/jansson-2.9.tar.gz
# tar -zxvf  jansson-2.9.tar.gz
# cd jansson-2.9
# ./configure
# make
# make install
Go back to asterisk-certified-13.8-cert2 and run ./configure Verify if the pjsip channel driver dependencies have been successfully installed.
# make menuselect
If all res_pjsip has (*) then you are good. Proceed with the installation.
# make 
# make install
You should see the following
 +---- 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    +
 +-------------------------------------------+
#
If you want Asterisk to start at boot time use the following command to setup the Asterisk service. You should have asterisk in /etc/init.d
# make config
# chkconfig --list | grep asterisk
asterisk        0:off   1:off   2:on    3:on    4:on    5:on    6:off
Error Encountered
# asterisk /usr/sbin/asterisk -C /etc/asterisk/asterisk.conf
asterisk: error while loading shared libraries: libjansson.so.4: cannot open shared object file: No such file or directory
Solution
# ln -s /usr/local/lib/libjansson.so.4 /usr/lib/libjansson.so.4
# echo /usr/local/lib > /etc/ld.so.conf.d/asterisk.conf
# ldconfig
Verify if you can locate libjansson.so.4
# updatedb
# locate libjansson.so.4
You should be able to list /usr/lib/libjansson.so.4

No comments:

Post a Comment