安装 Centos 7
- Install Centos 7
Initial System Setup
Disable selinux
Update Your System
Install Additional Required Dependencies
Install Legacy Pear requirements
Firewalld Basic Configuration
Enable and Start MariaDB
Enable and Start Apache
Install Dependencies for Google Voice (if required)
Install iksemel
Add the Asterisk User
Install and Configure Asterisk
Download Asterisk source files。
Compile and install DAHDI
Compile and install pjproject
Compile and Install jansson
Compile and install Asterisk
Install Asterisk Soundfiles。
Set Asterisk ownership permissions。
Install and Configure FreePBX
A few small modifications to Apache。
Download and install FreePBX。
That's it!
Automatic Startup
★ Initial System Setup
用户必须是root 用户!
必须确认关闭 selinux.,否则会引起很多莫名其妙的错误
★ 关闭 selinux
In /etc/sysconfig/selinux,change the following lines:
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config
重新启动系统,执行命令 'sestatus' 检查是否关闭。结果必须是:
SELinux status: disabled
★ 更新系统
yum -y update
yum -y groupinstall core base “Development Tools”
★ 安装依赖包(确认完全安装成功,不能偷懒!)
yum -y install lynx mariadb-server mariadb php php-mysql php-mbstring tftp-server \
httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel \
audiofile-devel gtk2-devel subversion kernel-devel git php-process crontabs cronie \
cronie-anacron wget vim php-xml uuid-devel sqlite-devel net-tools gnutls-devel php-pear
★ 安装 Legacy Pear
pear install Console_Getopt
★ 防火墙设置
必须开启80端口来访问GUI
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
★ 开启,启动 MariaDB
You must have MariaDB running for freepbx to operate normally.It must start automatically,and be running continuously.
systemctl enable mariadb.service
systemctl start mariadb
Now that our MariaDB database is running, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit
mysql_secure_installation
安装mysql, 很多用户在这一步犯错误,这里不用输入用户密码,直接默认Enter 键。后续的脚本安装文件会配置数据库密码。其余的步骤可以选择Yes 选项。
★ 开启,启动 Apache
执行以下命令来开启,启动 web 服务器。
systemctl enable httpd.service
systemctl start httpd.service
★ 添加 Asterisk 系统用户
adduser asterisk -M -c “Asterisk User”
安装配置 Asterisk
★ 下载源代码
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz (如果没有asterisk 语音卡无需下载此包)
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz(同上)
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz
wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
★ 编辑安装 DAHDI(如果无asterisk 语音卡支持,无需安装,忽略此步骤)
cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
tar xvfz libpri-1.4-current.tar.gz
rm -f dahdi-linux-complete-current.tar.gz libpri-1.4-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
cd /usr/src/libpri-1.4.*
make
make install
★ 编译安装 pjproject
cd /usr/src
tar -xjvf pjproject-2.4.tar.bz2
rm -f pjproject-2.4.tar.bz2
cd pjproject-2.4
CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound\
--disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64
make dep
make
make install
★ 编译安装 jansson
cd /usr/src
tar vxfz jansson.tar.gz
rm -f jansson.tar.gz
cd jansson-*
autoreconf -i
./configure --libdir=/usr/lib64
make
make install
★ 编译安装 Asterisk
cd /usr/src
tar xvfz asterisk-13-current.tar.gz
rm -f asterisk-13-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64
contrib/scripts/get_mp3_source.sh
make menuselect
默认编译环境下已经支持了大部分的运行功能。如果需要MP3 支持(音乐等待等等),用户则需要开启'format_mp3 模块,编译到系统中。
保存退出以后,继续执行以下步骤,注意这里不用这些 make samples 命令!
make
make install
make config
ldconfig
chkconfig asterisk off
★ 安装语音文件.
'make install' 命令安装了标准语音质量的语音包。可以适用于大部分中小型系统的使用,或者处理能力不是很强大的平台,例如嵌入式的平台,树莓派等等。如果大型的系统,可以安装相对高清的语音文件格式。这里安装的是 (8khz) 'wav' 语音文件和 G722 (High Definition 'Wideband') audio.
cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
tar xvf asterisk-core-sounds-en-wav-current.tar.gz
rm -f asterisk-core-sounds-en-wav-current.tar.gz
tar xfz asterisk-extra-sounds-en-wav-current.tar.gz
rm -f asterisk-extra-sounds-en-wav-current.tar.gz
# Wideband Audio download
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-g722-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
rm -f asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-core-sounds-en-g722-current.tar.gz
rm -f asterisk-core-sounds-en-g722-current.tar.gz
★ 设置 Asterisk 权限(这里用户一定要确保执行)
chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib64/asterisk
chown -R asterisk. /var/www/
安装配置 FreePBX
★ 安装前修改 Apache 配置
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
systemctl restart httpd.service
★ 下载安装 FreePBX.
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz
tar xfz freepbx-13.0-latest.tgz
rm -f freepbx-13.0-latest.tgz
cd freepbx
./start_asterisk start
./install –n
常见问题:
1)登录界面以后,为什么asterisk 没有启动:
解决办法,登录系统后台,执行以下命令:
[root@localhost ~]# /usr/sbin/fwconsole restart
Running FreePBX shutdown...
Checking Asterisk Status...
sh: warning: setlocale: LC_ALL: cannot change locale (en_EN): No such file or directory
Asterisk Seems to be NOT running
Not running Pre-Asterisk Shutdown Hooks.
Running FreePBX startup...
Checking Asterisk Status...
sh: warning: setlocale: LC_ALL: cannot change locale (en_EN): No such file or directory
Run Pre-Asterisk Hooks
Starting Asterisk...
sh: warning: setlocale: LC_ALL: cannot change locale (en_EN): No such file or directory
99/100 [===========================>] 99%sh: warning: setlocale: LC_ALL: cannot change locale (en_EN): No such file or directory
100/100 [============================] 100%
Asterisk Started on 3109
Running Post-Asterisk Scripts
[root@localhost ~]#
[root@localhost ~]# asterisk -r
Asterisk 13.5.0, Copyright (C) 1999 - 2014, Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
Connected to Asterisk 13.5.0 currently running on localhost (pid = 3109)
localhost*CLI>
2)如何修改到中文显示界面:
访问高级设置,点击一下设置参数,修改到 zh_CN, 提交,更新设置。
3)默认安装后只有基本模块功能,如何添加其他的应用模块:
访问管理员菜单,点击模块管理,下载开启安装需要的模块
4)安装出现的报错信息:
installing files to /var/lib/asterisk/bin..error copying files:
'cp -rf' from src: '/var/www/html/admin/modules/framework/amp_conf/bin/*' to dst: '/var/lib/asterisk/bin'...details follow
cp: cannot stat '/var/www/html/admin/modules/framework/amp_conf/bin/*': No such file or directory
done, see errors below
installing files to /var/lib/asterisk/agi-bin..error copying files:
'cp -rf' from src: '/var/www/html/admin/modules/framework/amp_conf/agi-bin/*' to dst: '/var/lib/asterisk/agi-bin'...details follow
cp: cannot stat '/var/www/html/admin/modules/framework/amp_conf/agi-bin/*': No such file or directory
done, see errors below
此报错说明 脚本没有安装 framework 文件夹的所有文件,用户可以手动添加到安装路径
Updating Hooks...Done
Checking if directdids need migrating..already done
updating zap callgroup, pickupgroup..not needed
checking for delay_answer field..already exists
checking for reversal field..already exists
checking for pricid field..already exists
Checking if trunk table migration required..not needed
Checking if privacy manager options exists..already exists
Checking for noanswer_cid field..already exists
Checking for busy_cid field..already exists
Checking for chanunavail_cid field..already exists
Checking for noanswer_dest field..already exists
Checking for busy_dest field..already exists
Checking for chanunavail_dest field..already exists
Unable to add index to extensions field in users
Checking for General Setting migrations..not needed
Deleting unused globals..done
Converting IAX notransfer to transfer if needed..updated 0000 records
deleting obsoleted record_in and record_out entries..ok
checking for dest field in outbound_routes..already exists
checking for continue field in trunks..already exists
upgrading any zap trunks to dahdi if foundok
Generating CSS...Done
Module core successfully installed
Updating Hooks...Done
Generating CSS...Done
Module featurecodeadmin successfully installed
Updating Hooks...Done
Refreshing all UCP Assets, this could take a while...
Generating Module Scripts...Done
Generating Module CSS...Done
Generating Main Scripts...Done
Generating Main CSS...Done
Done!
Generating CSS...Done
Module ucp successfully installed
Updating Hooks...Done
Generating CSS...Done
Module logfiles successfully installed
Updating Hooks...Done
Checking for General Setting migrations..not needed
checking if Voicemail Admin (vmailadmin) is installed..not installed, ok
Generating CSS...Done
Module voicemail successfully installed
Updating Hooks...Done
Creating cel if needed..OK
checking for extra field..already exists
checking for userfield field..already deleted
Generating CSS...Done
Module cel successfully installed
Updating Hooks...Done
Generating CSS...Done
Module customappsreg successfully installed
Updating Hooks...Done
Generating CSS...Done
Module dashboard successfully installed
Updating Hooks...Done
checking for sipsettings table..already exists
Migrate rtp.conf values if needed and initialize
Generating CSS...Done
Module sipsettings successfully installed
Updating Hooks...Done
Generating CSS...Done
Module callrecording successfully installed
Updating Hooks...Done
Generating CSS...Done
Module userman successfully installed
Updating Hooks...Done
Done installing modules
Installing framework...
installing files to /var/www/html..done
installing files to /var/lib/asterisk/bin..done
installing files to /var/lib/asterisk/agi-bin..done
Checking for upgrades..
No further upgrades necessary
framework file install done, removing packages from module
file/directory: /var/www/html/admin/modules/framework/amp_conf removed successfully
file/directory: /var/www/html/admin/modules/framework/upgrades removed successfully
file/directory: /var/www/html/admin/modules/framework/start_asterisk removed successfully
file/directory: /var/www/html/admin/modules/framework/install removed successfully
file/directory: /var/www/html/admin/modules/framework/installlib removed successfully
Generating CSS...Done
Module framework successfully installed
Updating Hooks...Done
Done
Generating default configurations...
Checking for PEAR Console::Getopt..OK
Skipping extension and destination registry checks
Please update your modules and reload Asterisk by browsing to your server.
Finished generating default configurations
Trusting FreePBX...Trusted
Setting Permissions...
8200/8200 [============================] 100%
Finished setting permissions
You have successfully installed FreePBX
[root@localhost freepbx]# reboot
以上是成功安装结果
正常的中文登录界面: