Friday, September 21, 2012

Installing Asterisk 10.8.0 on CentOS 6.3 (64-bit)

The book “Asterisk: The Definitive Guide 3rd Edition” describes installing Asterisk 1.8.x.  This is my attempt to go through the installation instructions and adapt them for an Asterisk 10.8.0 install.  I assume you have CentOS 6.3 installed already and updated (yum update).

This guide follows the book’s installation type.  We will not be installing a pre-built package, but will be installing from the source code.  You can find package installation instructions at http://www.asterisk.org/downloads/yum.  Note that the packages are not always up to date and the book recommends installing the latest version from source.

Note 1: I am relatively new to Linux and completely new to Asterisk.  Perhaps this guide will help someone else perform the same operation I am doing, but this is mainly to chronicle my installation so that I can easily repeat it if necessary.

Note 2: For the purposes of this install, I have removed the “sudo” commands and will run all the commands as root (su –).

Remove any 32-bit libraries, perform a system update and reboot:

yum remove *.i386

image

yum update –y

image

# Reboot system if any updates were installed
reboot

Synchronize time and install the NTP (Network Time Protocol) daemon:

# Verify ntp daemon is installed
yum install –y ntp

image

# Set the current date/time from pool.ntp.org
ntpdate pool.ntp.org

# Verify ntp daemon runs at system startup
chkconfig ntpd on

# Start the NTP daemon
service ntpd start

image

Add a new system user “asteriskpbx”:

adduser asteriskpbx

passwd asteriskpbx

image

# Install sudo if not already present
yum install sudo

# Edit the /etc/sudoers file and add ‘asteriskpbx’
visudo

# NOTE: I added the entry manually using the following
echo 'asteriskpbx ALL=(ALL) ALL' >> /etc/sudoers

image

# Also add an entry for the group “wheel”
echo '%wheel ALL=(ALL) ALL' >> /etc/sudoers

# Edit /etc/group file and modify the line that starts
# with wheel so it reads: wheel:x:10:root,asteriskpbx

Install software dependencies:

yum install gcc.x86_64 gcc-c++.x86_64 make.x86_64 wget.x86_64 subversion.x86_64 libxml2-devel.x86_64 ncurses-devel.x86_64 openssl-devel.x86_64 vim-enhanced.x86_64

image

Create directory structure:

mkdir -p ~/src/asterisk-complete/asterisk

cd ~/src/asterisk-complete/asterisk

Check out the source code with Subversion (we will check out using a specific tag, 10.8.0)

svn co http://svn.asterisk.org/svn/asterisk/tags/10.8.0

image

(NEW) Install the SQLite3 development package:

yum install sqlite-devel.x86_64

To support Google Talk, install ikseml by downloading it from http://code.google.com/p/iksemel/

wget http://iksemel.googlecode.com/files/iksemel-1.4.tar.gz

tar -xvzf iksemel-1.4.tar.gz

cd ~/src/iksemel-1.4

./configure

make

make install

Build and install the software:

cd ~/src/asterisk-complete/asterisk/10.8.0

./configure

make

make install

make config

To install the asterisk program documentation (optional, requires doxygen):

# Verify doxygen is installed (for me, it was already)
yum install doxygen

make progdocs

Install additional sound prompts from menuselect:

cd ~/src/asterisk-complete/asterisk/10.8.0/

make menuselect

make install

Modify file permissions of the folders Asterisk was installed to:

chown -R asteriskpbx:asteriskpbx /usr/lib/asterisk/
chown -R asteriskpbx:asteriskpbx /var/lib/asterisk/
chown -R asteriskpbx:asteriskpbx /var/spool/asterisk/
chown -R asteriskpbx:asteriskpbx /var/log/asterisk/
chown -R asteriskpbx:asteriskpbx /var/run/asterisk/
chown asteriskpbx:asteriskpbx /usr/sbin/asterisk

On CentOS, disable SELinux:

# Change the value of SELINUX from enforcing to disabled, then REBOOT
nano /etc/selinux/config

Create the /etc/asterisk/ directory and copy the indications.conf sample file into it:

mkdir -p /etc/asterisk

chown asteriskpbx:asteriskpbx /etc/asterisk

cd /etc/asterisk/

cp ~/src/asterisk-complete/asterisk/10.8.0/configs/indications.conf.sample ./indications.conf

Copy the sample asterisk.conf file into /etc/asterisk and uncomment and change runuser= and rungroup= to asteriskpbx:

cp ~/src/asterisk-complete/asterisk/10.8.0/configs/asterisk.conf.sample /etc/asterisk/asterisk.conf

nano /etc/asterisk/asterisk.conf

Create the modules.conf file. Enable loading of modules automatically, and disable extra modules:

$ cat >> /etc/asterisk/modules.conf
; The modules.conf file, used to define which modules
; Asterisk should load (or not load).
;
[modules]
autoload=yes
; Resource modules currently not needed
noload => res_speech.so
noload => res_phoneprov.so
noload => res_ael_share.so
noload => res_clialiases.so
noload => res_adsi.so
; PBX modules currently not needed
noload => pbx_ael.so
noload => pbx_dundi.so
; Channel modules currently not needed
noload => chan_oss.so
noload => chan_mgcp.so
noload => chan_skinny.so
noload => chan_phone.so
noload => chan_agent.so
noload => chan_unistim.so
noload => chan_alsa.so
; Application modules currently not needed
noload => app_nbscat.so
noload => app_amd.so
noload => app_minivm.so
noload => app_zapateller.so
noload => app_ices.so
noload => app_sendtext.so
noload => app_speech_utils.so
noload => app_mp3.so
noload => app_flash.so
noload => app_getcpeid.so
noload => app_setcallerid.so
noload => app_adsiprog.so
noload => app_forkcdr.so
noload => app_sms.so
noload => app_morsecode.so
noload => app_followme.so
noload => app_url.so
noload => app_alarmreceiver.so
noload => app_disa.so
noload => app_dahdiras.so
noload => app_senddtmf.so
noload => app_sayunixtime.so
noload => app_test.so
noload => app_externalivr.so
noload => app_image.so
noload => app_dictate.so
noload => app_festival.so

[CTRL+D]

Configure musiconhold.conf:

$ cat >> musiconhold.conf
; musiconhold.conf
[default]
mode=files
directory=moh

[CTRL+D]

At this point the system should be ready to configure the dialplan and channels.  First, log out and then log in as asteriskpbx.  Enter the following command to ensure you have sudo access:

sudo ls /root/

Finally, to make life easier, include /usr/sbin and /sbin in the PATH variable for asteriskpbx.  Edit the file with nano or something similar.

# change PATH=$PATH:$HOME/bin to PATH=$PATH:$HOME/bin:/usr/sbin:/sbin
nano .bash_profile

At this point Asterisk looks to be installed successfully.  I will blog again with any updates.  I will be working on getting this working with our PBX at work (and my VOIP phone) and with Google Talk and with Skype.

No comments: