IGOS Nusantara dan FreePBX

Dari IGNwiki
Langsung ke: navigasi, cari

Installing FreePBX 12

Official FreePBX documentation covers just CentOS 6.x, this guide will provide step-by-step instructions for the more recent CentOS 7.x and RHEL 7.x distributions.

1. Install additional dependencies, which are required for FreePBX to work.

# 
yum install -y gcc gcc-c++ \
lynx bison mariadb-devel mariadb-server gmime-devel psmisc \
php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel \
libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel \
libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion \
kernel-devel git subversion kernel-devel php-process crontabs cronie \
cronie-anacron wget vim php-xml uuid-devel libtool sqlite-devel
 

2. Make sure that the Apache httpd daemon is set to start at boot.

# 
systemctl enable httpd.service; systemctl start httpd.service

3. Enable MySQL (now MariaDB in recent RHEL/CentOS versions) to start at boot.

# 
systemctl enable mariadb.service; systemctl start mariadb.service

4. Amankan MySQL

#
mysql_secure_installation

5. Make sure IPTABLES is either disabled and/or is not blocking external traffic.

# 
iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

8. Install PearDB.

# 
pear channel-update pear.php.net
pear install db-1.7.14
 

9. Add the required Asterisk user.

# 
adduser asterisk -M -c "Asterisk User"

10. Download Asterisk source and supporting libraries.

# 
cd /usr/src ;\
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz ;\
git clone https://github.com/akheron/jansson.git ;\
wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2
 

11. Compile and install pjproject.

# 
cd /usr/src
tar -xjvf pjproject-2.2.1.tar.bz2
cd pjproject-2.2.1
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
 

12. Compile and install jansson.

#
cd /usr/src/jansson
autoreconf -i
./configure --libdir=/usr/lib64
make
make install
 

13. Add EPEL 6 libresample libraries (forthcoming for EPEL 7, but will work OK).

#
rpm -Uvh \
https://dl.fedoraproject.org/pub/epel/6/x86_64/libresample-0.1.3-12.el6.x86_64.rpm \
https://dl.fedoraproject.org/pub/epel/6/x86_64/libresample-devel-0.1.3-12.el6.x86_64.rpm
 

13. Compile and install Asterisk.

#
ldconfig
cd /usr/src
tar -zvxf asterisk-13-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64
contrib/scripts/get_mp3_source.sh
make menuselect # SELECT format_mp3 on this screen, then Save + Exit
make
make install
make config
ldconfig
 

14. Install the Asterisk extra sounds package.

#
mkdir -p /var/lib/asterisk/sounds
cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
tar -zvxf asterisk-extra-sounds-en-wav-current.tar.gz
rm -f asterisk-extra-sounds-en-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
tar -zvxf asterisk-extra-sounds-en-g722-current.tar.gz
rm -f asterisk-extra-sounds-en-g722-current.tar.gz
 

15. Install and Configure FreePBX.

#
cd /usr/src
wget http://mirror.freepbx.org/freepbx-12.0.3.tgz
tar -zvxf freepbx-12.0.3.tgz
chown -R asterisk.asterisk /var/run/asterisk
chown -R asterisk.asterisk /etc/asterisk
chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk
mkdir -p /usr/lib/asterisk; chown -R asterisk.asterisk /usr/lib/asterisk
chown -R asterisk.asterisk /usr/lib64/asterisk
chown -R asterisk.asterisk /var/www/
 

15. Adjust PHP and Apache settings + set Apache to start at boot.

#
cp /etc/php.ini /etc/php.ini.orig
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.orig
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
systemctl enable httpd.service; systemctl start httpd.service
 

16. Configure MySQL database and set permissions.

#
export ASTERISK_DB_PW=amp109
mysqladmin -u root create asterisk
mysqladmin -u root create asteriskcdrdb
mysql -u root -e "GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
mysql -u root -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
mysql -u root -e "flush privileges;"
 

17. Start Asterisk and FreePBX.

#
cd /usr/src/freepbx
./start_asterisk start
rm -Rf /var/www/html/
./install_amp --installdb --username=asteriskuser --password=${ASTERISK_DB_PW}
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3
./start_asterisk restart
amportal chown
amportal a ma installall
amportal a reload
amportal a ma refreshsignatures
amportal chown
amportal restart

18. Restart Apache and access the website.

#
/bin/systemctl restart httpd.service

19. Continue to the admin interface to complete the setup and access FreePBX.

   http://www.mysite.com/admin/

Tautan: