如何在CentOS Linux下安装ASTERISK和FreePBX
发布网友
发布时间:2022-04-22 03:43
我来回答
共2个回答
热心网友
时间:2022-04-10 03:59
下面给出在linux 上安装Asterisk,FreePBX的基本步骤。
1. 首先是更新系统(可选)
在命令行中输入
sudo apt-get update
sudo apt-get upgrade
2. 安装LAMP (Apache2+MySQL+PHP)
在命令行输入
sudo tasksel
选择 LAMP Server
3. 添加额外的PHP 软件包
sudo apt-get install php5-gd php-pear php-db sox curl
4. 安装phpmyadmin (可选)
sudo apt-get install phpmyadmin
5. 安装asterisk
sudo apt-get install asterisk asterisk-mysql asterisk-mp3
6. 安装Freepbx准备工作
在安装Freepbx我们先要想好将Freepbx 安装在哪个目录下,FreePBX 为asterisk 的Web管理应用,可以帮助用户配置Asterisk等。
1) Ubuntu 的Web根目录为/var/www, 因此我们可以把FreePBX安装到/var/www/freepbx 目录下,为便于管理,创建三个子目录conf 设置文件
log 存放日志
public WEB应用。
sudo mkdir /var/www/freepbx/
sudo mkdir /var/www/freepbx/conf
sudo mkdir /var/www/freepbx/log
sudo mkdir /var/www/freepbx/public
2) 创建设置文件 /var/www/freepbx/conf/vhost.conf
sudo vim /var/www/freepbx/conf/vhost.conf
输入以下内容
<VirtualHost *:80>
ServerName freepbx
ServerAlias freepbx
ServerAdmin james.shen@guidebee.com
ErrorLog /var/www/freepbx/log/error.log
CustomLog /var/www/freepbx/log/access.log combined
DocumentRoot /var/www/freepbx/public
<Directory /var/www/freepbx/public>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
AllowOverride All
Allow from all
</Directory>
<Directory /var/www/freepbx/public/admin>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile freepbx-passwd
Require user admin
</Directory>
</VirtualHost>
修改 ServerAdmin 到你自己的Email地址。
3) 将vhost 添加到 Apache的sites-enabled目录下
sudo ln -s /var/www/freepbx/conf/vhost.conf /etc/apache2/sites-available/freepbx
cd /etc/apache2/sites-enabled/
sudo ln -s ../sites-available/freepbx
4) 创建 用户和密码来验证合法用户可以来配置FreePBX (有权限访问该网页)
sudo htpasswd -c /etc/apache2/freepbx-passwd admin
5) 重启Apache
sudo /etc/init.d/apache2 restart
有了这些准备工作后,就可以开始安装FreePBX了
7. 安装FreePBX
1) 下载FreePBX安装包
cd /tmp
wget http://mirror.freepbx.org/freepbx-2.8.1.tar.gz
cd /usr/src
sudo tar xvzf /tmp/freepbx-2.8.1.tar.gz
cd freepbx-2.8.1/
2) 创建数据库
mysqladmin create asterisk -u root -p
mysqladmin create asteriskcdrdb -u root -p
mysql -u root -p asterisk < SQL/newinstall.sql
mysql -u root -p asteriskcdrdb < SQL/cdr_mysql_table.sql
3) 创建数据库用户
mysql -u root -p
在SQL命令行输入GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ‘badasspassword’;
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ‘badasspassword’;
flush privileges;
quit;
注意将badasspassword 换成你自己选择的密码。
4) 备份moles.conf , FreePBX安装时会修改Apache的配置文件
sudo cp /etc/asterisk/moles.conf ~/asterisk-moles.conf
5) 安装FreePBX
sudo ./install_amp
输入对应的参数
Enter your USERNAME to connect to the 'asterisk' database:
[asteriskuser] asterisk
Enter your PASSWORD to connect to the 'asterisk' database:
[amp109] badasspassword
Enter the hostname of the 'asterisk' database:
[localhost]
Enter a USERNAME to connect to the Asterisk Manager interface:
[admin]
Enter a PASSWORD to connect to the Asterisk Manager interface:
[amp111]
Enter the path to use for your AMP web root:
[/var/www/html]
/var/www/freepbx/public
Enter the IP ADDRESS or hostname used to access the AMP web-admin:
[xx.xx.xx.xx] freepbx
Enter a PASSWORD to perform call transfers with the Flash Operator Panel:
[passw0rd] password
Use simple Extensions [extensions] admin or separate Devices and Users [deviceanser]?
[extensions]
Enter directory in which to store AMP executable scripts:
[/var/lib/asterisk/bin]
6)恢复asterisk-moles.conf
sudo cp ~/asterisk-moles.conf /etc/asterisk/moles.conf
7) 添加asterisk用户
sudo adser www-data asterisk
修改权限/etc/amportal.conf 中添加
AMPASTERISKUSER=www-data
AMPASTERISKGROUP=asterisk
AMPASTERISKWEBUSER=www-data
AMPASTERISKWEBGROUP=asterisk
重启amportal
sudo amportal start
8) 使用amport 启动Asterisk
sudo update-rc.d -f asterisk remove
sudo sed -e s/BACKGROUND=0/BACKGROUND=1/ -i /usr/sbin/safe_asterisk
修改/etc/rc.local
在exit 0 前添加
/usr/local/sbin/amportal start
至此,安装完毕。
热心网友
时间:2022-04-10 05:17
1、Lamp的安装
下载所有软件包到/usr/local/src路径
配置yum源,安装相关软件
yum –y update
yum install –y httpd http-devel mysql mysql-devel mysql-server php php-devel php-mysql
yum install php5 php5-cli php5-mysql php-pear libapache2-mod-php5 php5-curl php5-gd php-db
mkdir /var/lib/mysql
chown –R mysql:mysql /var/lib/mysql
/etc/init.d/httpd start
chkconfig –level 35 httpd on
mysql_install_db
chown –R mysql.mysql /var/lib/mysql
/etc/init.d/mysqld start
chkconfig –level 35 mysqld on
mysqladmin –uroot password 123456 #设置mysql密码为123456
cp /usr/share/doc/mysql-server-5.0.22/my-medium.cnf /etc/my.cnf
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd restart
vim /var/www/html/index.php
测试一下 :
测试php连接apache : <? phpinfo(); ?>
测试php连接mysql : vim /usr/local/apache2/htdocs/aaa.php
<?php
$link=mysql_connect(“localhost”,”root”,”123456″);
if(!$link) echo “FAILD!”;
else echo “OK!”;
?>
访问下即可。
service iptables stop
iptables –F
setenforce 0
vi /etc/selinux/config
修改SElinux = disable
重启系统
2、asterisk的安装
1
cd /usr/local/src/asterisk-1.6.2.18/
useradd -c “Asterisk PBX” -d /var/lib/asterisk asterisk
mkdir /var/run/asterisk
mkdir /var/log/asterisk
chown -R asterisk:asterisk /var/run/asterisk
chown -R asterisk:asterisk /var/log/asterisk
chown -R asterisk:asterisk /var/lib/php/session/
chown -R asterisk /var/lib/php #比较重要
vim +231 /etc/httpd/conf/httpd.conf 将用户、组修改为 asterisk
vim +327 /etc/httpd/conf/httpd.conf 将 None 修改为 All
./configure
make
make install
make samples
make progdocs
/etc/init.d/mysqld restart
3、freePBX的安装:
yum install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel libtiff-devel gmp php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel audiofile-devel libogg-devel openssl-devel mysql-devel zlib-devel perl-DateManip sendmail-cf sox
yum install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring nano tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion kernel-devel
yum install festival festival-dev
yum install ncurses-base ncurses-bin ncurses-term libncurses5 libncursesw5 libncurses5-dev libncursesw5-dev
yum install zlib1g zlib1g-dev
yum install bison bison-doc
yum install install libxml2 libxml2-dev
yum install libtiff4 libtiff4-dev
yum install libasound2 libgsm1 libltdl3 libpq4 libspeex1 libsqlite0 libtonezone1 libaudiofile0 libaudiofile-dev
yum install libnet-telnet-perl mime-construct libipc-signal-perl libmime-types-perl libproc-waitstat-perl
cd /usr/local/src/freepbx-2.9.0/
mysqladmin create asterisk –uroot –p123456
mysqladmin create asteriskcdrdb –uroot –p123456
mysql asterisk < SQL/newinstall.sql –uroot –p123456
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql –uroot –p123456
mysql –uroot –p123456
GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY ‘123456’;
GRANT ALL PRIVILEGES ON asterisk.* TO asterisk@localhost IDENTIFIED BY ‘123456’;
grant all privileges on *.* to asterisk@localhost identified by “123456”;
flush privileges;
exit
用asterisk登陆一下mysql试试:mysql –uasterisk –p123456
如果成功,表明设置正确。
./start_asterisk start
mkdir /var/www/html/asterisk/
mkdir /var/www/html/asterisk/cgi-bin
chown -R asterisk:asterisk /var/www/html/asterisk
./install_amp
将【asteriskuser】设置为 asterisk(连接数据库的用户名)
将【amp109】设置为 123456(连接数据库的密码)
24 如何在CentOS Linux下安装ASTERISK和FreePBX
再上面的选项上键入需要访问的ip地址。如:192.168.1.43
32 1024x548 如何在CentOS Linux下安装ASTERISK和FreePBX
保持默认配置即可。
即可访问!!!!!!!!!!!!!!!
http://192.168.1.43/admin/
如果访问不成功
rm -rf /etc/amportal.conf
再 ./install_amp 重新配置一遍
如果还不成功,那么:
rm -rf /etc/asterisk/*
./install_amp
用这条命令检查一下文件是否存在:
vim /etc/asterisk/sip.conf
四、配置内部通讯:
1、登录freepbx管理界面
http://192.168.1.43/admin/config.php
2、选择setup菜单栏的Extensions 选项。
freepbxextension 如何在CentOS Linux下安装ASTERISK和FreePBX
然后选择右边的Add Extension
3350515 如何在CentOS Linux下安装ASTERISK和FreePBX
45137 1024x541 如何在CentOS Linux下安装ASTERISK和FreePBX
选择:Submit
51 如何在CentOS Linux下安装ASTERISK和FreePBX
出现添加对话框
63 1024x558 如何在CentOS Linux下安装ASTERISK和FreePBX
在User Extension一项填入用户分机号, 如888
在 Disply Name 一项填入用户显示名, 如888
下拉对话框
755 如何在CentOS Linux下安装ASTERISK和FreePBX
填入密码:如123456。
选择 提交即可。这时服务器端已经添加了一个内部账号,接着在客户端注册这个账号。
打开eyebeam软件
810 如何在CentOS Linux下安装ASTERISK和FreePBX
选择上面的向下箭头show menu
然后选择 SIP account setting
选择 Add 添加一个账号
Display Name 中填入服务器上设置好的内容,如:888
User name 中填入服务器上设置好的user extension内容,如:888
Password 中填入刚才设置好的密码,如123456
Authorization user name中填入服务器上设置好的user extension内容,如:888
Domain中填入服务器的ip地址,如192.168.1.43
完成后点击确定即可。
再点击close关闭SIP Accounts对话框,完成注册。
最后按照如上注册步骤再注册一个客户端,就可以实现内部互相拨打电话了。