FreePBX 14 + Asterisk 15 + MariaDB10 + CentOS 6.10

by silverark
5 deployments · 0 still active · last rev. 27 days ago

Install FreePBX ona centSOS server with the commercial supported modules.

For help please visit

We can help install and configure your FreePBX server

Compatible with: CentOS 6.8
###FreePBX 14 + Asterisk 15 + MariaDB10 + CentOS 6.10###
###By: Matt Nelson - ###
###Rev 2###

# This updates the packages on the system from the distribution repositories.
yum update -y
yum upgrade -y

#mariadb setup
touch /etc/yum.repos.d/MariaDB.repo
echo "[mariadb]" >> /etc/yum.repos.d/MariaDB.repo
echo "name = MariaDB">> /etc/yum.repos.d/MariaDB.repo
echo "baseurl =" >> /etc/yum.repos.d/MariaDB.repo
echo "gpgkey=" >> /etc/yum.repos.d/MariaDB.repo
echo "gpgcheck=1" >> /etc/yum.repos.d/MariaDB.repo

#Freepbx Commercial support
wget -P /etc/yum.repos.d/ -N
yum clean all
yum -y install sysadmin fail2ban incron ImageMagick

# This section disables SELinux
setenforce 0
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

# Install Development Tools

yum -y update
yum -y groupinstall core base "Development Tools"

# Add Asterisk User
adduser asterisk -m -c "Asterisk User"

# This section will install required FreePBX/Asterisk dependencies

yum -y install lynx tftp-server unixODBC mysql-connector-odbc MariaDB-server MariaDB-client \
  httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel \
  audiofile-devel gtk2-devel subversion kernel-devel git crontabs cronie \
  cronie-anacron wget vim uuid-devel sqlite-devel net-tools gnutls-devel python-devel texinfo \
  libuuid-devel MariaDB-shared

# Install PHP 5.6 Repositories

yum -y install epel-release
rpm -Uvh

# Install PHP 5.6w
yum -y remove php*
yum -y install php56w php56w-pdo php56w-mysqlnd php56w-mbstring php56w-pear php56w-process php56w-xml php56w-opcache php56w-ldap php56w-intl php56w-soap

# Need to install zend-guard-loader
cd /usr/src
wget -O zend.tar.gz
tar -zxvf zend.tar.gz
cp zend-loader-*/ /usr/lib64/php/modules/

touch /etc/php.d/zendguard.ini
echo "zend_extension=/usr/lib64/php/modules/" >> /etc/php.d/zendguard.ini

yum -y install sysadmin fail2ban incron ImageMagick

# Install nodeJS

curl -sL | bash -
yum install -y nodejs

# Enable and start MariaDB

service mysql start

# Lock down MySQL

# Make sure that NOBODY can access the server without a password
mysql -e "UPDATE mysql.user SET Password = PASSWORD('sCrw62gbvfdbdcw3tyCCWS') WHERE User = 'root'"
# Kill the anonymous users
mysql -e "DROP USER ''@'localhost'"
# Because our hostname varies we'll use some Bash magic here.
mysql -e "DROP USER ''@'$(hostname)'"
# Kill off the demo database
mysql -e "DROP DATABASE test"
# Make our changes take effect
# Any subsequent tries to run queries this way will get access denied because lack of usr/pwd param

# Enable and Start Apache
service httpd start

# Install Legacy Pear Requirements

pear install Console_Getopt 

# Download Asterisk Source

cd /usr/src
wget -O jansson.tar.gz

# Compile and Install Jansson

cd /usr/src
tar vxfz jansson.tar.gz
rm -f jansson.tar.gz
cd jansson-*
autoreconf -i
./configure --libdir=/usr/lib64
make install

# Compile and Install Asterisk

cd /usr/src
tar xvfz asterisk-15-current.tar.gz
rm -f asterisk-15-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64 --with-pjproject-bundled
make install
make config
chkconfig asterisk off

# Set Asterisk permissions

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/

# Add some things to 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

service httpd restart

#In case there is a previous half baked installation remove these files
rm /etc/amportal.conf
rm /etc/freepbx.conf

# Download and Install FreePBX

cd /usr/src
tar xfz freepbx-14.0-latest.tgz
rm -f freepbx-14.0-latest.tgz
cd freepbx
./start_asterisk start
./install -n --dbuser root --dbpass sCrw62gbvfdbdcw3tyCCWS

# Install All Available Modules

amportal a ma installall

# Upgrade All Installed Modules

amportal a ma upgradeall

# Fix Unsigned Modules

amportal chown
amportal a ma refreshsignatures
amportal a reload

# For help please visit  We can help install and configure your FreePBX server