So, time to kick things off! I get a lot of traffic on my older post about setting up Asterisk 1.6.2 on Centos 5.4, but that’s over a year old now and a lot has changed! The Asterisk project has decided to get sane about their version numbering once again, and has released a long-term support version of their project, Asterisk 1.8. This post will detail the minimum required to get Asterisk 1.8 up and running on CentOS 5.6, but don’t worry, I’ll cover adding in extra modules and setting up some of the new features that were included with Asterisk 1.8 in future posts. With that out of the way, let’s get on with the post!
First things first, we’ll assume you’ve got a fresh CentOS 5.6 installed with the basest of options – i.e a 1 disc install. This is how I do it, because this will prevent the installer from installing any extra services or modules that you don’t need on an Asterisk box. The first thing you’ll want to do is update your existing system:
yum update
Next we’ll disable SELinux – I’ve never had this do anything good for me on an Asterisk box. Use your favorite editor, open the file /etc/selinux/config and change the option SELINUX= to ‘disabled’.
vi /etc/selinux/config
SELINUX=disabled
After you make this change to SELinux, you’ll need to reboot. This will also give any new kernels that may have been updated with your ‘yum update’ command a chance to be started.
shutdown -r now
Next, we’ll install the needed dependencies to get a minimal install of asterisk running. This is the bare minimum needed to get a working asterisk install. It does not cover any extra modules or any of the new features of Asterisk 1.8. We’ll cover the steps needed to get those installed in a later post.
yum install wget gcc gcc-c++ make perl libxml2-devel ncurses-devel newt-devel openssl-devel kernel-devel
This should download and install several programs and additional dependencies needed to make these programs work. While not needed for the barest of asterisk installs, I am including kernel-devel so that we can install DAHDI, which, even if you don’t have a TDM card installed in your machine, still provides the best timer option for asterisk.
Next, we’ll move on to downloading and installing the actual code needed to make asterisk run. While there are pre-compiled binaries available for asterisk, and asterisk-specific repositories available for yum, I prefer to install asterisk from source. This gives you complete control over the modules you want installed, and allows you to go back and add in any extra modules or customized (or even patched) code you may want at a later date.
First, I always make a specific asterisk directory under /usr/src, that way I know where all of my asterisk related source code files are. Then we’ll download the necessary source code from the asterisk.org download site and extract it.
mkdir /usr/src/asterisk
cd /usr/src/asterisk
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
tar zxvf libpri-1.4-current.tar.gz
tar zxvf dahdi-linux-complete-current.tar.gz
tar zxvf asterisk-1.8-current.tar.gz
First, we’ll install LibPRI and DAHDI. If you don’t have a PRI card installed, don’t worry, installing LibPRI won’t hurt anything. Also, DAHDI is needed if you’ve got any kind of TDM card installed in your system, but even if you don’t, DAHDI still provides a great timing source and is required if you want to use the MeetMe() conference application. In this tutorial I’ll assume we don’t have a TDM card and we’re just using DAHDI as a timing source.
cd /usr/src/asterisk/libpri-1.4.11.5
make
make install
cd /usr/src/asterisk/dahdi-linux-complete-2.4.1.2+2.4.1
make all
make install
make config
Once you’ve got these installed, you’ll need to edit the config files for DAHDI for optimal performance. You’ll find the necessary config files in the directory /etc/dahdi/, and the specific files you’ll want to look through and possibly modify are:
/etc/dahdi/modules
/etc/dahdi/system.conf
Go through the modules file and comment out any hardware you don’t have, to make the DAHDI service load time faster. In our case of no modules, we comment out every option. This will force the system to only load DAHDI for timing purposes.
If you’ve actually got a hardware TDM card installed in the system, the quickest way to get a working system.conf file is to run the command ‘dahdi_genconf’. This will probe your installed hardware and generate a system.conf that applies to your specific hardware. You can then go in and make any carrier specific modifications you may need.
Next, we’ll install asterisk itself. There are a few more steps involved here than in the previous programs we loaded, but the reward is more control over what goes into your asterisk install.
cd /usr/src/asterisk/asterisk-1.8.4
./configure
make menuselect
On this screen, you’ll want to go through and make some specific changes. First, you’ll want to disable the chan_mgcp Channel Driver. This is because it works best with a package we haven’t installed, and unless you specifically need to support MGCP phones, unchecking this won’t hurt your install any. Also, for maximum compatibility, I would recommend using the -WAV version of any sound files you may select. If you’ve got the bandwidth and the space on your machine, I would also recommend downloading any codec-specific versions of the sound files you plan on using. You may also want to disable any non-dahdi timing source in the Resource Modules section (look for res_timing_ and uncheck any that aren’t res_timing_dahdi).
Now that we’ve got everything we need selected, tab your way over to the ‘Save & Exit’ button and we’ll move on to the next steps, compiling and installing. These steps will take some time (up to five-ten minutes, depending on your system and the number of cores you have installed), so sit back and relax.
make
make install
Now that we’ve got the asterisk core installed, let’s install the sample configuration files and system init files. You can skip this step if you’ve got an existing asterisk install and you were just upgrading, but for clean installs, this step is almost necessary.
make samples
make config
Next, we’ll test our Asterisk install by launching Asterisk from the command line and reviewing the resulting logs that are displayed on-screen for any errors.
service dahdi start
asterisk -cvvvv
If everything looks good, go ahead and exit out of our Asterisk test environment (using the asterisk command “core stop now”).
And finally let’s enable DAHDI and Asterisk to start at system boot time.
chkconfig dahdi on
chkconfig asterisk on
Now either reboot your system or just simply start asterisk using the command ‘service asterisk start’, and away you go! If you come up with any compile-time errors or run-time errors, or just plain have any questions, please feel free to post them in the comments below and I’ll do my best to try and answer them quickly!
16 Responses to “How to setup Asterisk 1.8 on CentOS 5”
Trackbacks/Pingbacks
- How to setup Asterisk 1.6.2 on Centos 5.4 | SelbyTech - [...] 05/20/2011 – An updated version of this post, detailing How to setup Asterisk 1.8, has been posted. Check it ...
- 店員 » SIPサーバを立ててSo-netフォンをsipdroidで受ける - [...] インストール方法は各種ドキュメントに譲るとして、設定ファイルは以下。 [...]




Thanks for this great post.
Helped me alot!
Ciao,
Marcel
In the case of an Ubuntu OS, dahdi is started here: /etc/init.d/dahdi start
I do prefer Centos though!
Good post
Don’t forget install Kernel Sources, that is necessary for “make all” Dahdi
Did you forget to add “contrib/scripts/get_mp3_source.sh” after you cd over to asterisk directory?
I got this message (( The configure script must be executed before running ‘make’. ))
what mean that
1. first run ./configure script
2. make
3. make install
4. make samples
5. make config
Great post!
Can you give me some tips to install Asterisk 1.8 with PAE-kernel? I can`t achive install libpri. I got a dependencies error message.
Regards.
Rafael you need kernel-PAE-devel
yum install kernel-PAE-devel -y
Hi,
Great Post will try it this weekend.
Hi All:
I followed these instructuctions and created a user but i am not able to register my CPE:
[1000]
secret=password1234
hasvoicemail = yes
vmsecret = 1000
hassip = yes
hasiax = no
hash323 = no
hasmanager = no
callwaiting = no
context = default
regexten= 1000
host=dynamic
nat=yes
Is there anything that needs to be done?
Running “chkconfig asterisk on” returns
error reading information on service asterisk: No such file or directory
Thank you for an excellent post. We used the guide today to install asterisk 1.8.7.1 on centos 5.7 and it works perfectly.
nice post, any guide for queuemetrics and vicidial?
I have installed Asterisk on Centos with the following components:
- Centos 5.7 kernel: 2.6.18-274.el5 #1 SMP Fri Jul 22 04:43:29 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
- dahdi-linux-complete-2.5.0.1+2.5.0.1
- libpri-1.4.12
- asterisk 1.8.7.1
This is the output when i installed dahdi-linux-complete-2.5.0.1+2.5.0.1:
[root@localhost dahdi-linux-complete-2.5.0.1+2.5.0.1]# make all
make -C linux all
make[1]: Entering directory `/share/dahdi-linux-complete-2.5.0.1+2.5.0.1/linux’
make -C drivers/dahdi/firmware firmware-loaders
make[2]: Entering directory `/share/dahdi-linux-complete-2.5.0.1+2.5.0.1/linux/drivers/dahdi/firmware’
make[2]: Leaving directory `/share/dahdi-linux-complete-2.5.0.1+2.5.0.1/linux/drivers/dahdi/firmware’
You do not appear to have the sources for the 2.6.18-274.el5 kernel installed.
make[1]: *** [modules] Error 1
make[1]: Leaving directory `/share/dahdi-linux-complete-2.5.0.1+2.5.0.1/linux’
make: *** [all] Error 2
Please help me resolve this error?
Thanks.
Install went like a dream. No issues if you follow the instructions.
Thanks
Helped me a lot