You're not sure what the best way to install Asterisk is—should you install from your distribution's packages, or do a source install?
Currently, there are packages only for Debian, and they are behind the current stable release. In this chapter, we're going to install Asterisk on CentOS 5.0. CentOS is a Red Hat Enterprise Linux clone. It's very stable, and Asterisk runs well on it.
See Recipe 5.2 for apt-getting your way to Asterisk on Debian.
Hardware requirements are the minimum suggested for a test system. Asterisk needs a lot of horsepower. Your Asterisk server must be a dedicated server—don't try to run other services on it.
Hardware requirements:
A PC with at least a 500 MHz CPU
256 MB RAM
CD drive
10 GB hard drive
Sound card and speakers, or a USB headset
An Internet connection for downloading additional sound files during the installation (optional)
Software requirements:
The standard Linux build environment, which includes gcc, automake, glibc-devel, glibc-headers, glibc-kernheaders, binutils, doxygen, and kernel-devel. Grab all of them at once by installing the Development Tools package group:
# yum groupinstall "Development Tools"
Then, install these packages to satisfy Asterisk dependencies:
# yum install ncurses ncurses-devel openssl openssl-devel zlib zlib-devel newt newt-devel
Now, download the current releases of the three main source tarballs from Asterisk.org (http://www.asterisk.org/downloads) into the /usr/src directory. This example uses the 1.4.4 release:
[root@asterisk1 src]# wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.
4.tar.gz \
http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.3.tar.gz \
http://ftp.digium.com/pub/libpri/releases/libpri-1.4.0.tar.gz
Unpack them:
[root@asterisk1 src]# tar zxvf asterisk-1.4.4.tar.gz
[root@asterisk1 src]# tar zxvf zaptel-1.4.3.tar.gz
[root@asterisk1 src]# tar zxvf libpri-1.4.0.tar.gz
As always, look in each source directory for READMEs, installation notes, and other important information, and review them before starting installation.
The three Asterisk packages must be installed in order. First, enter the Zaptel directory, and run these commands:
# cd zaptel-1.4.3
# make clean
# ./configure
# make
# make install
Then, change to the libpri directory and install it:
# cd ../libpri-1.4.0/
# make clean
# make
# install
Now comes the big fun—installing Asterisk:
# cd ../asterisk-1.4.4
# make clean
# ./configure
# make menuselect
make menuselect
is a good
place to spend a bit of time reviewing your options. This is where you
customize Asterisk, unlike previous versions that came in monolithic
blobs:
************************************* Asterisk Module Selection ************************************* Press 'h' for help. ---> 1. Applications 2. Call Detail Recording 3. Channel Drivers 4. Codec Translators 5. Format Interpreters 6. Dialplan Functions 7. PBX Modules 8. Resource Modules 9. Voicemail Build Options 10. Compiler Flags 11. Module Embedding 12. Core Sound Packages 13. Music On Hold File Packages 14. Extras Sound Packages
Navigate with these commands:
scroll => up/down arrows (de)select => Enter select all => F8 deselect all => F7 back => left arrow quit => q save and quit => x
In the Module Selection menu, XXX means dependencies have not been met. menuselect tells you what you need to satisfy missing dependencies, as this example shows:
************************************* Asterisk Module Selection ************************************* Press 'h' for help. [*] 1. codec_adpcm [*] 2. codec_alaw [*] 3. codec_a_mu [*] 4. codec_g726 [*] 5. codec_gsm [*] 6. codec_ilbc [*] 7. codec_lpc10 XXX 8. codec_speex [*] 9. codec_ulaw [*] 10. codec_zap Speex Coder/Decoder Depends on: speex
In this example, I need to install the
speex-devel package to satisfy the dependency.
(Speex is great little patent-free compression format designed
especially for voice communications.) These must be installed before
Asterisk. To save time, go through all the
menuselect options and note what packages, if
any, you need to install. You want the -devel
packages, which in this example is speex-devel.
Install them all at once, then rerun make
clean, ./configure
, and make
menuselect
.
menuselect is a bit overwhelming, so if you don't understand all the options, accept the defaults. You can always redo it later.
Then run these commands:
# make
# make install
# make config
# make progdocs
You're all finished, and ready to start learning how to run your Asterisk server.
If you are used to Asterisk 1.2, please note that the installation procedure is different. Now there are
./configure options for the Zaptel drivers and
Asterisk, which you can view with ./configure--help
.
Soundfiles are installed differently than in 1.2. The Asterisk 1.4 tarball package includes English prompts in GSM format and the FreePlay MOH (Music-on-Hold) files in WAVE format. You may select more from menuselect. You might elect to install only the defaults, then add others later because some of the tarballs are huge. For example, asterisk-extra-sounds-en-wav-1.4.1.tar.gz is 144 MB.
It might seem unnecessary to run make
clean
on a new installation, but there are often the odd
object files and other random leftover bits floating around. make clean
ensures that you start with a
clean slate.
Asterisk helpfully makes it clear when an installation command has succeeded, and tells you what to do next:
+--------- Asterisk Build Complete ---------+ + Asterisk has successfully been built, and + + can be installed by running: + + + + make install + +-------------------------------------------+
It is important to read the READMEs and other informational files in the source trees.
Zaptel drivers control the Digium interface cards, so you might think you don't need to bother with the drivers if you're not using Digium hardware. But you still need a timing device for functions like music on hold and conferencing. The ztdummy module provides this. In 2.6 kernels, it interacts directly with the system's hardware clock. In 2.4 kernels, it took its timing from the usb-uhci kernel module. Documents that refer to the usb-uhci module are outdated. You should be running Asterisk on a Linux distribution with a 2.6 kernel in any case. See the README in the Zaptel source directory to see which modules go with which hardware.
To see a list of the package groups on CentOS, use Yum:
$ yum grouplist
This command displays a list of packages in a group:
$ yum groupinfo "Development Tools"
Asterisk Documentation Project: http://www.asteriskdocs.org/modules/news/
Asterisk Support: http://www.asterisk.org/support
Chapter 2, "Installing and Managing Software on RPM-Based Systems," in Linux Cookbook, by Carla Schroder (O'Reilly)