當前位置:編程學習大全網 - 源碼下載 - 如何在CentOS Linux下安裝ASTERISK和FreePBX

如何在CentOS Linux下安裝ASTERISK和FreePBX

下面給出在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) 備份modules.conf , FreePBX安裝時會修改Apache的配置文件

sudo cp /etc/asterisk/modules.conf ~/asterisk-modules.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 [deviceanduser]?

[extensions]

Enter directory in which to store AMP executable scripts:

[/var/lib/asterisk/bin]

6)恢復asterisk-modules.conf

sudo cp ~/asterisk-modules.conf /etc/asterisk/modules.conf

7) 添加asterisk用戶

sudo adduser 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

至此,安裝完畢。

  • 上一篇:pkg-config怎麽確定庫的版本
  • 下一篇:手繪背景墻DIY把握 手繪背景墻清除之妙招
  • copyright 2024編程學習大全網