asterisk1.6安装过程

asterisk1.6安装全过程2009-11-29 10:26也许相似的文章网上很多,简单介绍下,写给初学装新版本的鸟类们,老鹰门还是直接飞过吧。。。。。

1)我采用的环境是centos5.0,linux内核是2.6.18-92.el5xen 晚点我会将其升级成最新内核

2)装好系统我是默认完全安装的,默认我集成了mysql ,方便以后使用

3)获取安装包,可以去https://www.360docs.net/doc/2417276618.html,上下载最新的。

※注:在安装centos时,默认不用完全安装也行。但是必须集成开发工具。

做好准备工作现在开始安装。

[root@~]# wget https://www.360docs.net/doc/2417276618.html,/pub/telephony/asterisk/releases/asterisk-1.6.1.9.tar.gz

后边的版本号可以随自己想装的版本改变,如果不太熟悉wget命令的朋友也可以用sshsecureshell 上传。

步入正题

[root@~]# tar -zxvf asterisk-1.6.1.9.tar.gz // 解压asterisk安装包

[root@~]# cd asterisk-1.6.1.9 // 进入asterisk安装包

[root@asterisk asterisk-1.6.1.9]# ./configure // 环境检测和预配置

[root@asterisk asterisk-1.6.1.9]# make clean //清理旧的编译中间文件 这里说明一下,我很多时候不输入感觉没什么区别呵呵

[root@asterisk asterisk-1.6.1.9]# make all // 从新编译所有文件

+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running: +
+ +
+ make install +
+-------------------------------------------+
安装到这里软件会提示使用make install 来安装asterisk

[root@asterisk asterisk-1.6.1.9]# make install // 安装asterisk

+---- Asterisk Installation Complete -------+
+ +
+ YOU MUST READ THE SECURITY DOCUMENT +
+ +
+ Asterisk has successfully been installed. +
+ If you would like to install the sample +
+ configuration files (overwriting any +
+ existing config files), run: +
+ +
+ make samples +
+ +
+----------------- or ---------------------+
+ +
+ You can go ahead and install the asterisk +
+ program documentation now or later run: +
+ +
+ make progdocs +
+ +
+ **Note** This requires that you have +
+ doxygen installed on your local system +
+-------------------------------------------+

这里提示make samples 来安装配置模板 这个模板很是强大,但

是不代表你就什么都不用设置了哈。还有一个make progdocs 来安装一些程序文档暂时用不到呵呵。

[root@asterisk asterisk-1.6.1.9]# make samples // 安装配置模板

到这askterisk安装完毕。

我们启动一下。

[root@asterisk asterisk-1.6.1.9]# asterisk -vvvvvvvvvvvvvvvvvc 这里v代表调试级别,v越多级别越高,别人是这么告诉我的哈!

下边来讲解一下一些主要的配置文件,简单来做下配置

asterisk.conf //asterisk的心脏文件 主配置文件 一般情况下。不需要去改动

sip.conf //sip协议主要配置文件

extensions.conf //拨号规则配置文件

下边我门来做两个帐号进行一下互通测试 这里主要用到sip.conf 和extensions.conf

首先来做sip.conf

[root@ ~]# vi /etc/asterisk/sip.conf

[sip](!) // 定义小节名,因为测试sip协议所以叫sip;(!)的意思是定义为抽象类
type=friend // 定义以下帐号均为友端,除此还有user用户端、peer对端
host=dynamic // 定义动态主机 说明帐号每次均动态注册
nat=yes // 定义启用nat协议 如果终端是内网用户必须起用
disallow=all // 定义首先关闭所有编码
allow=gsm // 定义帐号编码为gsm
canreinvite=no // 暂时不解释
context=mrlan // 定义此段内的所有帐号的拨号规则全部对应[mrlan]段落

[1001](sip) // 定义此帐户名字为84516666,后边跟随(sip)表示执行sip小节里的所有属性
accountcode=1001 // 指定帐户登陆名
secret=123456 // 指定密码

在配置拨号规则文件extensions.conf

[root@ ~]# vi /etc/asterisk/extensions.conf

[mrlan]
exten => _10,1,Dial(SIP/${EXTEN},,r)

然后登陆1001,并以1001为例子在做个1002,然后测试下通话。到此asterisk安装完毕。通话成功!

欢迎大家留言交流,

补充一下:

如果选择精简安装的话需要检测以下软件包是否有

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 kernel-devel

如果没有的话可以用yum install安装

yum install kernel-devel

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


有人说:你们就是把开源的东西改改汉化一下,就收钱~
我想说:请尊重我们的劳动,您可以选择不用,这是您的权利!
同时我还想说:感谢开源社区那么多无私程序员的劳动,让我们以如此低廉的成本用上这么先进的通讯软件。
并且同时提醒:asterisk系统就像汽车的零件,组装好是宝马,如果不了解它,那么带给你的将是一台永远开不走的破夏利!

闲话少叙,让我们开始迈出第一步,安装asterisk基本环境:

安装CentOS 5.4 DVD 光盘版,选择costom安装方式,不安装无用的,如果想方便那不选上x-windows .
进到#号下,一般我们选择/usr/src目录进行下载及安装:
cd /usr/src
//进行环境配置:
//更换语言:
vi /etc/sysconfig/i18n
//将LANG="zh_CN.UTF-8" 换成 LANG="en_US.UTF-8"
//增加DNS解晰:
vi /etc/resolv.conf
//添加 nameserver 202.97.224.68
//安装YUM环境:
https://www.360docs.net/doc/2417276618.html,/index.php?p=36&a=view&r=23
//安装开发环境及编绎环境:
yum -y groupinstall 'Development Tools'
yum -y install libtool*
yum -y install kernel-heads*
yum -y install ncurses-dev*
yum -y install kernel-devel
yum install -y kernel kernel-devel
//安装apache、PHP、MYSQL环境:
yum -y install httpd php mysql mysql-server php-mysql
/sbin/chkconfig httpd on
/sbin/chkconfig --add mysqld
/sbin/chkconfig mysqld on
/sbin/service httpd start
/sbin/service mysqld start
//设置mysql数据库root帐号密码。
mysqladmin -u root password 'newpassword' [引号内填密码]
//让mysql数据库更安全
mysql -u root -p [此时会要求你输入刚刚设置的密码,输入后回车即可]
mysql> DROP DATABASE test; [删除test数据库]
mysql> DELETE FROM https://www.360docs.net/doc/2417276618.html,er WHERE user = ''; [删除匿名帐户]
mysql> FLUSH PRIVILEGES; [重载权限]
//安装apache扩展 //安装php的扩展//安装mysql扩展
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
yum -y install php-gd
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
//下载最新的ver:1.6版本
wget https://www.360docs.net/doc/2417276618.html,/pub/telephony/libpri/libpri-1.4.10.2.tar.gz
wget https://www.360docs.net/doc/2417276618.html,/pub/telephony/asterisk/releases/asterisk-1.6.2.8-rc1.tar.gz
wget https://www.360docs.net/doc/2417276618.html,/pub/telephony/asterisk/releases/asterisk-addons-1.6.2.1.tar.gz
wget https://www.360docs.net/doc/2417276618.html,/pub/telephony/dahdi-linux/releases/dahdi-linux-2.3.0.tar.gz
wget https://www.360docs.net/doc/2417276618.html,/pub/telephony/dahdi-tools/releases/dahdi-tools-2.3.0.tar.gz
//安装libpri:
tar zxvf libpri-1.4.10.2.tar.gz
cd libpri-1.4.10.2
make
make install
cd ..
//安装dahdi驱动:
tar zxvf dahdi-linux-2.3.0.tar.gz
cd dahdi-linux-2.3.0
make
make install
cd ..
//安装dahdi-tools工具:
tar zxvf dahdi-tools-2.3.0.tar.gz
cd dahdi-tools-2.3.0
./configure
make
make install

make config
cd ..
//安装asterisk:
tar zxvf asterisk-1.6.2.8-rc1.tar.gz
cd asterisk-1.6.2.8-rc1
./configure
make
make install
make config
make samples
cd ..
//安装asterisk扩展包(H323\mysql支持):
tar zxvf asterisk-addons-1.6.2.1.tar.gz
cd asterisk-addons-1.6.2.1
./configure
make
make install
make samples
至此asterisk的基本环境安装完毕!

另:安装asterisk的yum方式:


Use the text editor of your choice to create a new file named "centos-asterisk.repo" in the "/etc/yum.repos.d" folder. Add the following text to the file:
[asterisk-tested]
name=CentOS-$releasever - Asterisk - Tested
baseurl=https://www.360docs.net/doc/2417276618.html,/centos/$releasever/tested/$basearch/
enabled=0
gpgcheck=0
#gpgkey=https://www.360docs.net/doc/2417276618.html,/RPM-GPG-KEY-Digium
[asterisk-current]
name=CentOS-$releasever - Asterisk - Current
baseurl=https://www.360docs.net/doc/2417276618.html,/centos/$releasever/current/$basearch/
enabled=1
gpgcheck=0
#gpgkey=https://www.360docs.net/doc/2417276618.html,/RPM-GPG-KEY-Digium
Save the new file and create another named "centos-digium.repo" and insert the following text:
[digium-tested]
name=CentOS-$releasever - Digium - Tested
baseurl=https://www.360docs.net/doc/2417276618.html,/centos/$releasever/tested/$basearch/
enabled=0
gpgcheck=0
#gpgkey=https://www.360docs.net/doc/2417276618.html,/RPM-GPG-KEY-Digium
[digium-current]
name=CentOS-$releasever - Digium - Current
baseurl=https://www.360docs.net/doc/2417276618.html,/centos/$releasever/current/$basearch/
enabled=1
gpgcheck=0
#gpgkey=https://www.360docs.net/doc/2417276618.html,/RPM-GPG-KEY-Digium
At this point your system has been updated to use the Asterisk and Digium repositories in addition to the base CentOS repositories. You are now ready to install Asterisk. To star the installation, execute the following at the Linux command line:
[root@localhost~]# yum install asterisk16 asterisk16-configs asterisk16-voicemail dahdi-linux dahdi-tools libpri
The system will respond with something like:

相关文档
最新文档