[KVM CentOS] FreePBX 14 and Asterisk 14 installation on CentOS 7

Laurab
Laurab
edited October 13 in KVM Based Servers

FreePBX is a web-based open source GUI (graphical user interface) that controls and manages Asterisk (PBX), an open source communication server. FreePBX is licensed under the GNU General Public License (GPL), an open source license.  We will install FreePBX and Asterisk on freshly installed CentOS 7.

Prerequisites

Install CentOS 7 in the Client Area:
Login to your VPS using SSH

Let's update our freshly installed OS:
yum update
1. Let's check if SELinux is disabled as this can be a cause for unexpected troubles:
sestatus
In results you should see "Disabled"

2. Install additional packets that we need to set up FreePBX and Asterisk:
yum -y groupinstall core base "Development Tools"
Install additional dependencies:
yum -y install lynx tftp-server unixODBC unixODBC-devel 
mysql-connector-odbc mariadb-server mariadb httpd ncurses-devel sendmail
 sendmail-cf sox newt-devel libxml2-devel libtiff-devel audiofile-devel 
gtk2-devel subversion kernel-devel kernel-headers git crontabs cronie 
cronie-anacron wget vim uuid-devel sqlite sqlite-devel net-tools 
gnutls-devel python-devel texinfo libuuid-devel libxml2-devel 
libsrtp-devel libtool-ltdl libtool-ltdl-devel e2fsprogs-devel 
keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel 
libxml2-devel libtiff-devel gmp audiofile-devel libogg-devel 
openssl-devel zlib-devel perl-DateManip sox git wget net-tools psmisc 
speex-devel gsm-devel libtool libtool-ltdl libtool-ltdl-devel xmlstarlet
3. Let's add repositories for PHP 5:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Install PHP 5.6 for FreePBX
yum install php56w php56w-pdo php56w-mysql php56w-mbstring php56w-pear 
php56w-process php56w-xml php56w-opcache php56w-ldap php56w-intl 
php56w-soap
4. Setup nodeJS:
curl -sL https://rpm.nodesource.com/setup_8.x | bash --
yum install -y nodejs
5. Setup MySQL autostart for "cdr" record data saving from Asterisk:
systemctl enable mariadb.service
systemctl start mariadb
Setup secure settings for MySQL:
mysql_secure_installation
Attention! Do not set up any of user "root" password

6. Add user "Asterisk"
adduser asterisk -m -c "Asterisk User"
7. Set up Apache to autostart and star it:
systemctl enable httpd.service
systemctl start httpd.service
8. Add Perl extension:
pear install Console_Getopt
9. Set up "srtp" for create a possibility to Asterisk send encrypted "rtp" data:
cd /usr/src && wget http://sourceforge.net/projects/srtp/files/srtp/1.4.4/srtp-1.4.4.tgz
tar zxvf srtp-*.tgz &&
sed -i 's/RTPW\=rtpw/RTPW\=\.\/rtpw/' /usr/src/srtp/test/rtpw_test.sh &&
cd srtp && autoconf &&
./configure CFLAGS=-fPIC --prefix=/usr &&
make &&
make runtest &&
make uninstall &&
make install
10. Setup libjansson
cd /usr/src
wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.10.tar.gz
tar vxfz jansson.tar.gz
rm -f jansson.tar.gz
cd jansson-*
autoreconf -i
./configure --libdir=/usr/lib64
make
make install
11. Download Asterisk packets:
cd /usr/src &&
wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz &&
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz
12. Setup Lame for MP3 format coding:
cd /usr/src &&
tar zxvf lame-3.98.4.tar.gz &&
cd lame-3.98.4 &&
./configure &&
make &&
make uninstall &&
make install
13. Setup and compile Dahdi and LibPri:
cd /usr/src &&
tar xvfz dahdi-linux-complete-current.tar.gz &&
cd dahdi-linux-complete-* &&
make all &&
make install &&
make config
cd /usr/src &&
tar xvfz libpri-*.tar.gz &&
cd /usr/src/libpri-* &&
make &&
make install
14. Setup and compile Asterisk 14:
cd /usr/src &&
tar xvfz asterisk-14*.tar.gz &&
cd asterisk-14.*
Configure:
./configure --libdir=/usr/lib64 --with-pjproject-bundled --with-crypto --with-ssl=ssl --with-srtp
contrib/scripts/get_mp3_source.sh
make menuselect



make && make install && make config && ldconfig
15. Change owner privilegies:
chown asterisk.asterisk /var/run/asterisk &&
chown -R asterisk.asterisk /etc/asterisk &&
chown -R asterisk.asterisk /var/{lib,log,spool}/asterisk &&
chown -R asterisk.asterisk /usr/lib64/asterisk
16. Change apache settings:
sed -i 's/^upload_max_filesize = .*/upload_max_filesize = 120M/' /etc/php.ini
sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf &&
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
systemctl restart httpd.service && systemctl enable httpd

FreePBX installation and setup


17. Download FreePBX:
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-14.0-latest.tgz
tar xfz freepbx-14.0-latest.tgz
Setup it:
cd freepbx
./start_asterisk start
./install -n
18. Setup FreePBX to autostart:
Create a file:
nano /etc/systemd/system/freepbx.service
And insert this script:
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
[Install]
WantedBy=multi-user.target
Autostart of FreePBX:
systemctl enable freepbx.service
systemctl start freepbx
Check if FreePBX started correctly:
systemctl status -l freepbx.service
19. By default the port 80 for http connection is filtered on our CentOS template as you can only access this port from the actual localhost and not from any other public host. To open a port 80 on we need to add an iptables rule. For this template uses firewall-cmd. First add your port 80 rule with a following command:
firewall-cmd --zone=public --add-port=80/tcp --permanent
Once you add the above firewall rule reload firewall service:
firewall-cmd --reload
And check whether the port was added to ipatables rules:
iptables-save | grep 80
-A IN_public_allow -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW -j ACCEPT
And you are DONE!  FreePBX documention: http://wiki.freepbx.org/



Sign In or Register to comment.
© 2013 - 2017 Time4VPS. All rights reserved. Powered by Vanilla
The opinions or views of users on the forum are those of the author and not of Time4VPS.