There are several methods of getting Asterisk: via the Subversion code repository, via wget from the downloads site, or via a package-management system such as apt-get or yum. We’re only going to cover the first two methods, since we’re interested in building the latest version of Asterisk from source. Typically, package-management systems will have versions that are older than those available from Subversion or the downloads site, and we want to make sure we have the most recent fixes available to us, so we tend to avoid them.
The official packages from Digium do tend to stay up to date. There are currently packages for CentOS/RHEL available at http://www.asterisk.org/downloads/yum.
Before we start getting the source files, let’s create a directory structure to house the downloaded code. We’re going to create the directory structure within the home directory for the asteriskpbx user on the system. Once everything is built, it will be installed with the sudo command. We’ll then go back and change the permissions and ownership of the installed files in order to build a secure system. To begin, issue the following command:
$
mkdir -p ~/src
/asterisk-complete/asterisk
Now that we’ve created a directory structure to hold everything, let’s get the source code. Choose one of the following two methods to get your files:
Subversion is a version control system that is used by developers to track changes to code over a period of time. Each time the code is modified, it must first be checked out of the repository; then it must be checked back in, at which point the changes are logged. Thus, if a change creates a regression, the developers can go back to that change and remove it if necessary. This is a powerful and robust system for development work. It also happens to be useful for Asterisk administrators seeking to retrieve the software. To download the source code to the latest version of Asterisk 1.8, use these commands:
$cd ~/src/asterisk-complete/asterisk
$svn co http://svn.asterisk.org/svn/asterisk/branches/1.8
You can now skip directly to the section called “How to Install It”.
To obtain the latest released versions of DAHDI, LibPRI, and Asterisk using the wget application, issue the following commands:
$cd ~/src/asterisk-complete/asterisk
$wget \ http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
$tar zxvf asterisk-1.8-current.tar.gz
The next step is to compile and install the software, so onward to the next section.