How to Install It

With the source files downloaded you can compile the software and install it. The order for installing is:

  1. LibPRI[31]

  2. DAHDI[32]

  3. Asterisk[33]

Installing in this order ensures that any dependencies for DAHDI and Asterisk are installed prior to running the configuration scripts, which will subsequently ensure that any modules dependent on LibPRI or DAHDI will be built.

So, let’s get started.

LibPRI

LibPRI is a library that adds support for ISDN (PRI and BRI). The use of LibPRI is optional, but since it takes very little time to install, doesn’t interfere with anything, and will come in handy if you ever want to add cards to a system at a later point, we recommend that you install it now.

Check out the latest version of LibPRI and compile it like so:

$ cd ~/src/asterisk-complete/
$ mkdir libpri
$ cd libpri/
$ svn co http://svn.asterisk.org/svn/libpri/tags/1.4.<your version number>
$ cd 1.4.<your version number>
$ make
$ sudo make install

Note

You can also download the source via wget from http://downloads.asterisk.org/pub/telephony/libpri/.

With LibPRI installed, we can now install DAHDI.

DAHDI

The Digium Asterisk Hardware Device Interface, or DAHDI (formerly known as Zaptel), is the software Asterisk uses to interface with telephony hardware. We recommend that you install it even if you have no hardware installed, because DAHDI is a dependency required for building the timing module res_timing_dahdi and is used for Asterisk dialplan applications such as MeetMe().

Another dependency is required for installing DAHDI, and that is the kernel source. It is important that the kernel version being used match exactly that of the kernel source being installed. You can use uname -a to verify the currently running kernel version:

  • CentOS: sudo yum install kernel-devel-`uname -r`

  • Ubuntu: sudo apt-get install linux-headers-`uname -r`

The use of uname -r surrounded by backticks (`) is for filling in the currently running kernel version so the appropriate package is installed.

The following commands show how to install DAHDI-linux-complete 2.4.0+2.4.0. There may be a newer version available by the time you are reading this, so check downloads.asterisk.org first. If there is a newer version available, just replace the version number in the commands:

$ cd ~/src/asterisk-complete/
$ mkdir dahdi
$ cd dahdi/
$ svn co http://svn.asterisk.org/svn/dahdi/linux-complete/tags/2.4.0+2.4.0
$ cd 2.4.0+2.4.0
$ make
$ sudo make install
$ sudo make config

Warning

You will need to have Internet access when running the make all command, as it will attempt to download the latest hardware firmware from the Digium servers.

After installing DAHDI, we can move on to installing Asterisk.

Note

You can also download the source via wget from http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/.

Asterisk

With both DAHDI and LibPRI installed, we can now install Asterisk:

$ cd ~/src/asterisk-complete/asterisk/1.8
$ ./configure
$ make
$ sudo make install
$ sudo make config

With the files now installed in their default locations, we need to modify the permissions of the directories and their contents.

Note

There is an additional step that is not strictly required, but is quite common (and arguably important): the make menuselect command, which provides a graphical interface that allows detailed selection of which modules and features will be compiled. We will discuss this in the section called “make menuselect”.

Setting File Permissions

In order to run our system more securely, we’ll be installing Asterisk and then running it as the asteriskpbx user. After installing the files into their default locations, we need to change the file permissions to match those of the user we’re going to be running as. Execute the following commands after running make install (which we did previously):

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

In order to use MeetMe() and DAHDI with Asterisk as non-root, you must change the /etc/udev/rules.d/dahdi.rules so that the OWNER and GROUP fields match the non-root user Asterisk will be running as. In this case, we’re using the asteriskpbx user.

Change the last line of the dahdi.rules file to the following:

SUBSYSTEM=="dahdi", OWNER="asteriskpbx", GROUP="asteriskpbx", MODE="0660"

With that out of the way, we can move on to performing the base configuration that should be done after all installations.



[31] Strictly speaking, if you are not going to be using any ISDN connections (BRI and PRI), you can install Asterisk without LibPRI. However, we are going to install it for the sake of completeness.

[32] This package contains the kernel drivers to allow Asterisk to connect to traditional PSTN circuits. It is also required for the MeetMe() conferencing application. Again, we will install this for completeness.

[33] If you don’t install this, none of the examples in this book will work, but it could still make a great bathroom reader. Just sayin’.