Saturday, July 7, 2007

Installing Asterisk from source on CentOS


"trust the source luke"   -unknown.


( Also verified on Suse 10.1 )


  1. Acknowledgements

    1. Asterisk: The Future of Telephony, Chapter 3 - Installing Asterisk. This is a very well written book and a pleasure to read. Get a print copy, you won't regret it.

    2. CentOS is an excellent OS OS (Open Source Operating System), please consider donating to this project - http://www.centos.org/

    3. LUG and NOOSS mates I hang out with.

  2. Install CentOS 4.x

    • Review CentOS 4.4 Installation Guide

    • During the installation, when asked to choose package groups, choose "Everything". Doing so, will save you from a lot of headaches during the asterisk installation, imho.

    • Storage is cheap and you can always turn off services you don't need, see below (login as root first) :

      1. If you are installing asterisk on a dedicated box, it likely doesn't need to run X all of the time, you can turn off X by changing the default runlevel on your asterisk system to 3 (from 5). Edit /etc/inittab and change the line with "initdefault" from 5 to 3.

      2. To view the list of services running at runlevel 3

        /sbin/chkconfig --list | grep 3:on | more

      3. Turn off services you don't need one by one. For eg. to turn off postgresql at all runlevels (if you don't plan to use it on your asterisk box)

        /sbin/chkconfig -level 345 postgresql off

    • update installed packages to current releases before proceeding (thanks Tzafrir)

      yum update

      The above step will take quite a while, when it completes reboot your machine and repeat the "yum update" command. When it completes reboot again

  3. Downloading Asterisk Sources (as root)

    mkdir /usr/src/pbx
    mkdir /usr/src/pbx/source
    cd /usr/src/pbx/source

    wget --passive-ftp ftp.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz

    wget --passive-ftp ftp.digium.com/pub/asterisk/asterisk-addons-1.4-current.tar.gz

    wget --passive-ftp ftp.digium.com/pub/libpri/libpri-1.4-current.tar.gz

    wget --passive-ftp ftp.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz

  4. Source Extraction

    cd /usr/src/pbx
    tar zxvf source/asterisk-1.4-current.tar.gz
    tar zxvf source/asterisk-addons-1.4-current.tar.gz
    tar zxvf source/libpri-1.4-current.tar.gz
    tar zxvf source/zaptel-1.4-current.tar.gz

  5. Compiling and Installing (follow this order)

    (!!!Watch!!! your version numbers may differ)

    cd zaptel-1.4.3/
    make clean
    make # -- errors out asking for a restart, not to worry
    make
    make install

    cd ../libpri-1.4.0/
    make clean
    make
    make install

    cd ../asterisk-1.4.6/
    make clean
    ./configure
    make
    make install
    make samples

    cd ../asterisk-addons-1.4.2/
    make clean
    ./configure
    make
    make install # -- (if you get an error msg, see bugfix below)

    (*** script bugfix ***)
    cd asterisk-ooh323c/.libs/
    ln -s libchan_h323.1.0.1 libchan_h323.so.1.0.1
    cd ../..
    make install
    (*** end of bugfix ***)

  6. Post Installation

    (check that asterisk is configured to be ON)

    /sbin/chkconfig --list | grep asterisk

    (and if needed...no harm done either way)

    /sbin/chkconfig -level 2345 asterisk on

    (Reboot your asterisk machine)

    /sbin/shutdown -r now

    (upon reboot connect to asterisk CLI console with)

    asterisk -r

    (to exit asterisk CLI console)

    quit

    man asterisk # -- (for other neat stuff)