安裝 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 用戶!
必須確認(rèn)關(guān)閉 selinux.,否則會(huì)引起很多莫名其妙的錯(cuò)誤
★ 關(guān)閉 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
重新啟動(dòng)系統(tǒng),執(zhí)行命令 'sestatus' 檢查是否關(guān)閉。結(jié)果必須是:
SELinux status: disabled
★ 更新系統(tǒng)
yum -y update
yum -y groupinstall core base “Development Tools”
★ 安裝依賴包(確認(rèn)完全安裝成功,不能偷懶。
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
★ 防火墻設(shè)置
必須開(kāi)啟80端口來(lái)訪問(wèn)GUI
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
★ 開(kāi)啟,啟動(dòng) 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, 很多用戶在這一步犯錯(cuò)誤,這里不用輸入用戶密碼,直接默認(rèn)Enter 鍵。后續(xù)的腳本安裝文件會(huì)配置數(shù)據(jù)庫(kù)密碼。其余的步驟可以選擇Yes 選項(xiàng)。
★ 開(kāi)啟,啟動(dòng) Apache
執(zhí)行以下命令來(lái)開(kāi)啟,啟動(dòng) web 服務(wù)器。
systemctl enable httpd.service
systemctl start httpd.service
★ 添加 Asterisk 系統(tǒng)用戶
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 (如果沒(méi)有asterisk 語(yǔ)音卡無(wú)需下載此包)
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(如果無(wú)asterisk 語(yǔ)音卡支持,無(wú)需安裝,忽略此步驟)
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
默認(rèn)編譯環(huán)境下已經(jīng)支持了大部分的運(yùn)行功能。如果需要MP3 支持(音樂(lè)等待等等),用戶則需要開(kāi)啟'format_mp3 模塊,編譯到系統(tǒng)中。
保存退出以后,繼續(xù)執(zhí)行以下步驟,注意這里不用這些 make samples 命令!
make
make install
make config
ldconfig
chkconfig asterisk off
★ 安裝語(yǔ)音文件.
'make install' 命令安裝了標(biāo)準(zhǔn)語(yǔ)音質(zhì)量的語(yǔ)音包?梢赃m用于大部分中小型系統(tǒng)的使用,或者處理能力不是很強(qiáng)大的平臺(tái),例如嵌入式的平臺(tái),樹(shù)莓派等等。如果大型的系統(tǒng),可以安裝相對(duì)高清的語(yǔ)音文件格式。這里安裝的是 (8khz) 'wav' 語(yǔ)音文件和 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
★ 設(shè)置 Asterisk 權(quán)限(這里用戶一定要確保執(zhí)行)
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
常見(jiàn)問(wèn)題:
1)登錄界面以后,為什么asterisk 沒(méi)有啟動(dòng):
解決辦法,登錄系統(tǒng)后臺(tái),執(zhí)行以下命令:
[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)如何修改到中文顯示界面:
訪問(wèn)高級(jí)設(shè)置,點(diǎn)擊一下設(shè)置參數(shù),修改到 zh_CN, 提交,更新設(shè)置。
3)默認(rèn)安裝后只有基本模塊功能,如何添加其他的應(yīng)用模塊:
訪問(wèn)管理員菜單,點(diǎn)擊模塊管理,下載開(kāi)啟安裝需要的模塊
4)安裝出現(xiàn)的報(bào)錯(cuò)信息:
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
此報(bào)錯(cuò)說(shuō)明 腳本沒(méi)有安裝 framework 文件夾的所有文件,用戶可以手動(dòng)添加到安裝路徑
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
以上是成功安裝結(jié)果
正常的中文登錄界面: