Download methods
There are various methods of downloading Asterisk. The source is available as FTP and HTTP downloads from Digium's servers and a couple of mirror sites. However, we will cover the latest method which involves the use of SVN to download from the Digium SVN repository. The commands below include downloading packages with apt-get, which comes with Debian-based Linux systems. If you are using another distribution, you will need to work out the equivalent procedure for obtaining the required packages.
Prerequisites
First of all, it's worth updating the list of available packages by running :
apt-get update
Use the following commands to download the packages (including any further required packages) prior to compiling Asterisk :
apt-get install ncurses-base libncurses5-dev libssl-dev zlib1g-dev \
gcc g++ make subversion \
kernel-headers-`uname -r`
Now we need to check if our /usr/src/linux* links have been created. Type the following commands :
uname -r
ls -ld /usr/src/linux*
The first command tells you what your kernel version is. For example, 2.4.27-2-386. If the /usr/src/linux* directories do not exist we will need to add them. If they point to a different kernel source/header directory, then remove them.
To add our directories, use :
cd /usr/src
ln -s /usr/src/kernel-headers-`uname -r` /usr/src/linux
ln -s /usr/src/kernel-headers-`uname -r` /usr/src/linux-`uname -r`
Now follow the instructions at http://www.voip-info.org/wiki-Asterisk+Zaptel+Installation under Kernel Source to complete your setup prior to downloading Asterisk. You will only need to do all of this once, unless you change your kernel version.
Downloading Asterisk
Now that we have our kernel headers set up and have downloaded our prerequisite packages, we can download the source. Use the following commands to download zaptel and asterisk :
cd /usr/src
svn checkout http://svn.digium.com/svn/zaptel/branches/1.4 zaptel
svn checkout http://svn.digium.com/svn/asterisk/branches/1.4 asterisk
You can replace 1.4 with whichever version of Asterisk is current.
Once the files are downloaded, you can install any required patches before installing.
Things to look out for
If you are installing Asterisk over a previous version, it is always worth backing up your configuration files. When installing over a previous version, the files in /usr/lib/asterisk/modules/ do not get overwritten. Either rename the directory or remove all the files.
Some versions of Linux may have a pre-installed version of zaptel installed in a different directory. This could clash when you compile zaptel yourself. To see if you have this problem, go to /lib/modules/`uname -r` and compare the file timestamps under the misc and extra directories. Remove the older duplicates and re-install zaptel. This makes sure that the module dependencies are updated.