1.检查系统内核版本
#uname -a
Linux localhost.localdomain 2.6.18-92.el5xen #1 SMP Tue Jun 10 19:55:54 EDT 2008 i686 i686 i386 GNU/Linux
2.检查是否已经安装kernel-devel
# rpm -q kernel-devel
例如:kernel-devel-2.6.18-92.1.10.el5,表示已经安装,如果没有安装,要用yum安装一下,
如下 yum install kernel-devel
我的是没有安装的,不安装以后编译是个问题。
3.检查是否已经安装以下的辅助软件包
rpm -q bison
rpm -q bison-devel
rpm -q ncurses
rpm -q ncurses-devel
rpm -q zlib
rpm -q zlib-devel
rpm -q openssl
rpm -q openssl-devel
rpm -q gnutls-devel
rpm -q gcc
rpm -q gcc-c
rpm -q mysql-devel
最少mysql-devel需要安装
4.如果没有安装则用yum安装(一定要全部安装)
yum install bison
yum install bison-devel
yum install ncurses
yum install ncurses-devel
yum install zlib
yum install zlib-devel
yum install openssl
yum install openssl-devel
yum install gnutls-devel
yum install gcc
yum install gcc-c
yum install mysql-devel
5.下载libpri,zaptel,asterisk软件包
http://ftp.digium.com/pub/libpri/releases/libpri-1.4.7.tar.gz
http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.12.1.tar.gz (zaptel-1.4.11有bug,需要修改,所以下了1.4.12.1)
http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.22.tar.gz
http://ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.7.tar.gz
http://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.tar.gz
将下载的软件包放到自定义的目录下
我一般放在opt目录下,在/opt目录下直接wget上述地址即可下载。
6.解压缩软件包
cd /opt
tar -xvzf libpri-1.4.7.tar.gz
tar -xvzf zaptel-1.4.12.1.tar.gz
tar -xvzf asterisk-1.4.22.tar.gz
tar -xvzf asterisk-addons-1.4.7.tar.gz
tar -xvzf asterisk-sounds-1.2.1.tar.gz
rm -r *.gz
7.安装libpri
# cd libpri-1.4.7
# make
# make install
8.安装zaptel
# cd ..
# cd zaptel-1.4.12.1
# ./configure
# make (make is OK, make26 seems to be useless for recent zaptel versions)
# make install
# make config (to add zaptel startup script /etc/init.d/zaptel)
9.安装asterisk
如果没有少安装工具的话,以下安装是很顺利的
# cd ..
# cd asterisk-1.4.22
# ./configure
# make
# make install
# make samples
测试一下asterisk是否安装成功可以执行asterisk的主命令
# asterisk -vvvvvvvvc
如果这个时候提示cli> 表示已经成功
cli> stop now
退出asterisk
配置自动启动
# make config
10.安装asterisk-addons
请注意这个步骤需要使用Root身份并且需要你机器已经安装好编译调试工具.
另外,这个步骤需要机器已经安装有mysqlclient库,这个库在centos 5.2 系统选择mysql的情况下是默认不安装的,
需要yum install mysql-devel.
# cd ..
# cd asterisk-addons-1.4.7
# ./configure
# make
# make install
# make samples
11.安装asterisk-sounds
# cd ..
# cd asterisk-sounds-1.2.1
# make install