如何在CentOS Linux下安装ASTERISK和FreePBX

2025-01-05 00:45:24
推荐回答(1个)
回答1:

下面给出在linux 上安装Asterisk,FreePBX的基本步骤。1. 首先是更新系统(可选)在命令行中输入sudo apt-get updatesudo apt-get upgrade2. 安装LAMP (Apache2+MySQL+PHP)在命令行输入sudo tasksel选择 LAMP Server3. 添加额外的PHP 软件包sudo apt-get install php5-gd php-pear php-db sox curl4. 安装phpmyadmin (可选)sudo apt-get install phpmyadmin5. 安装asterisksudo apt-get install asterisk asterisk-mysql asterisk-mp36. 安装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/confsudo mkdir /var/www/freepbx/logsudo mkdir /var/www/freepbx/public2) 创建设置文件 /var/www/freepbx/conf/vhost.confsudo vim /var/www/freepbx/conf/vhost.conf输入以下内容VirtualHost *:80ServerName freepbxServerAlias freepbxServerAdmin james.shen@guidebee.comErrorLog /var/www/freepbx/log/error.logCustomLog /var/www/freepbx/log/access.log combinedDocumentRoot /var/www/freepbx/publicDirectory /var/www/freepbx/publicOptions Indexes FollowSymLinks MultiViewsOrder allow,denyAllowOverride AllAllow from all/DirectoryDirectory /var/www/freepbx/public/adminAuthType BasicAuthName "Restricted Area"AuthUserFile freepbx-passwdRequire user admin/Directory/VirtualHost修改 ServerAdmin 到你自己的Email地址。3) 将vhost 添加到 Apache的sites-enabled目录下sudo ln -s /var/www/freepbx/conf/vhost.conf /etc/apache2/sites-available/freepbxcd /etc/apache2/sites-enabled/sudo ln -s ../sites-available/freepbx4) 创建 用户和密码来验证合法用户可以来配置FreePBX (有权限访问该网页)sudo htpasswd -c /etc/apache2/freepbx-passwd admin5) 重启Apachesudo /etc/init.d/apache2 restart有了这些准备工作后,就可以开始安装FreePBX了7. 安装FreePBX1) 下载FreePBX安装包cd /tmpwget http://mirror.freepbx.org/freepbx-2.8.1.tar.gzcd /usr/srcsudo tar xvzf /tmp/freepbx-2.8.1.tar.gzcd freepbx-2.8.1/2) 创建数据库mysqladmin create asterisk -u root -pmysqladmin create asteriskcdrdb -u root -pmysql -u root -p asterisk SQL/newinstall.sqlmysql -u root -p asteriskcdrdb SQL/cdr_mysql_table.sql3) 创建数据库用户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.conf5) 安装FreePBXsudo ./install_amp输入对应的参数Enter your USERNAME to connect to the 'asterisk' database:[asteriskuser] asteriskEnter your PASSWORD to connect to the 'asterisk' database:[amp109] badasspasswordEnter 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/publicEnter the IP ADDRESS or hostname used to access the AMP web-admin:[xx.xx.xx.xx] freepbxEnter a PASSWORD to perform call transfers with the Flash Operator Panel:[passw0rd] passwordUse 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.confsudo cp ~/asterisk-modules.conf /etc/asterisk/modules.conf7) 添加asterisk用户sudo adduser www-data asterisk修改权限/etc/amportal.conf 中添加AMPASTERISKUSER=www-dataAMPASTERISKGROUP=asteriskAMPASTERISKWEBUSER=www-dataAMPASTERISKWEBGROUP=asterisk重启amportalsudo amportal start8) 使用amport 启动Asterisksudo update-rc.d -f asterisk removesudo sed -e s/BACKGROUND=0/BACKGROUND=1/ -i /usr/sbin/safe_asterisk修改/etc/rc.local在exit 0 前添加/usr/local/sbin/amportal start至此,安装完毕。