FreePBX with Google Voice Install

by chrisrios88
3 deployments · 0 still active · last rev. 10 days ago

Installs FreePBX along with Google Voice Support

Compatible with: CentOS 7
###FreePBX with Google Voice Support Script###
###By: Chris Rios###
###Rev 2###

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

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

# Add Firewall Rules for HTTP
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

# 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 \
  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 \

# Install PHP 5.6 Repositories

rpm -Uvh
rpm -Uvh

# Install PHP 5.6w

yum -y remove php*
yum -y install php56w php56w-pdo php56w-mysql php56w-mbstring php56w-pear php56w-process php56w-xml php56w-opcache php56w-ldap php56w-intl php56w-soap

# Install nodeJS

curl -sL | bash -
yum install -y nodejs

# Enable and start MariaDB

systemctl enable mariadb.service
systemctl start mariadb

# Lock down MySQL

# Make sure that NOBODY can access the server without a password
mysql -e "UPDATE mysql.user SET Password = PASSWORD('CHANGEME') 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

systemctl enable httpd.service
systemctl start httpd.service

# Install Legacy Pear Requirements

pear install Console_Getopt

# Install Google Voice Requirements 
cd /usr/src
wget -O
rm -f
cd iksemel-master
make install

# 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-14-current.tar.gz
rm -f asterisk-14-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
systemctl restart httpd.service

# 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 CHANGEME

# Download Motif Module for Google Voice

amportal a ma download

# Install Motif Module for Google Voice

amportal a ma install motif

# 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