Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installing FreePBX15 with Asterisk 16 on Compute Engine
## Create Compute
$ gcloud beta compute --project=dialogflow-ivr instances create "freepbx" --zone "us-central1-a" --machine-type=n1-standard-1 --subnet=default --network-tier=PREMIUM --maintenance-policy=MIGRATE --scopes=,,,,, --image=centos-7-v20200420 --tags "http-server","https-server" --image-project=centos-cloud --boot-disk-size=40GB --boot-disk-type=pd-standard --boot-disk-device-name=instance-1 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any
## Edit the VM, add the following metadata label:
startup-script : sudo ufw ssh
## SSH into the machine
$ gcloud compute ssh <instancename> --project=projectname
## Disable SELINUX
$ sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux
$ sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config
$ sudo reboot;
## Install all the tools
$ sudo yum -y update
$ sudo yum -y groupinstall core base "Development Tools"
$ sudo 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 unixODBC mysql-connector-odbc
$ sudo pear install Console_Getopt
## Firewall Config
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload
## Upgrade PHP from 5.4 to 5.6
$ sudo rpm -Uvh
$ sudo nano /etc/yum.repos.d/remi.repo
## change the enabled flag for the [remi] and [remi-php56] sections.
$ sudo yum -y upgrade php*
$ php -v
## Install Node JS and upgrade to latest version
$ curl -sL | sudo bash -
$ sudo yum install nodejs
$ sudo npm install -g n
$ sudo n stable
$ sudo ln -sf /usr/local/n/versions/node/12.16.2/bin/node /usr/bin/node
## MariaDB setup
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
$ mysql_secure_installation
## Enable and start Apache web server
$ systemctl enable httpd
$ systemctl start httpd
## Install dependancies for Google Voice (optional)
$ cd /usr/src
$ sudo wget
$ tar xf iksemel-*.tar.gz
$ rm -f iksemel-1.4.tar.gz
$ cd iksemel-*
$ ./configure
$ make
$ make install
## Download Asterisk 16
$ sudo wget
$ sudo wget
$ sudo wget
$ sudo wget -O jansson.tar.gz
$ sudo wget
# Install DAHDI (only required if you use PSTN hardware, T1, E1, etc.
$ cd /usr/src
$ tar xvfz dahdi-linux-complete-current.tar.gz
$ tar xvfz libpri-current.tar.gz
$ rm -f dahdi-linux-complete-current.tar.gz libpri-current.tar.gz
$ cd dahdi-linux-complete-*
$ make all
$ make install
$ make config
$ cd /usr/src/libpri-*
$ make
$ make install
## Compile and 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
## 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
$ make install
## Install Asterisk 16
$ sudo tar xvfz asterisk-16-current.tar.gz
$ cd asterisk-*
$ sudo contrib/scripts/install_prereq install
$ sudo ./configure --with-jansson-bundled --libdir=/usr/lib64
$ sudo contrib/scripts/
$ sudo make menuselect
# make menuselect will display a window in the terminal, check format_mp3 to add mp3 playback and encoding. - save and exit
$ sudo make
$ sudo make install
$ sudo make config
$ sudo ldconfig
$ sudo chkconfig asterisk off
## Installing higher quality asterisk sound files.
$ sudo /var/lib/asterisk/sounds
$ sudo wget
$ sudo wget
$ sudo tar xvf asterisk-core-sounds-en-wav-current.tar.gz
$ sudo 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
$ sudo wget
$ sudo wget$
$ sudo tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
$ rm -f asterisk-extra-sounds-en-g722-current.tar.gz
$ sudo tar xfz asterisk-core-sounds-en-g722-current.tar.gz
$ rm -f asterisk-core-sounds-en-g722-current.tar.gz
## setting asterisk user permissions. I had to add an asterisk user at this point.
$ sudo useradd asterisk
$ sudo chown asterisk. /var/run/asterisk
$ sudo chown -R asterisk. /etc/asterisk
$ sudo chown -R asterisk. /var/{lib,log,spool}/asterisk
$ sudo chown -R asterisk. /usr/lib64/asterisk
$ sudo chown -R asterisk. /var/www/
## Apache modifications.
$ sudo sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
$ sudo sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
$ sudo sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
$ sudo systemctl restart httpd.service
## Install FreePBX 15
# sudo nano /etc/sysconfig/asterisk
# comment out:
#AST_USER="asterisk" #AST_USER="asterisk"
$ cd /usr/src
$ sudo wget
$ tar xfz freepbx-15.0-latest.tgz
$ rm -f freepbx-15.0-latest.tgz
$ cd freepbx
$ sudo ./start_asterisk start
$ sudo ./install -n --dbpass $password-maria-db
# Centos 7 systemd config, to autostart freePBX on boot.
# Create a file named freepbx.service in /etc/systemd/system containing the following text:
Description=FreePBX VoIP Server
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.