Initial System Setup
Disable selinux
In /etc/sysconfig/selinux , change the following lines:
	
		
			| 
			sed-i 's/\(^SELINUX=\).*/\SELINUX=disabled/'/etc/sysconfig/selinux
 sed-i 's/\(^SELINUX=\).*/\SELINUX=disabled/'/etc/selinux/config
 | 
	
 
 
 
 
reboot, and verify the selinux status by running 'sestatus'. It should say:
Update Your System
	
		
			| 
			yum -y update
 yum -y groupinstall core base "Development Tools"
 | 
	
 
 
 
 
Install Additional Required Dependencies
	
		
			| 
			yum -y installlynx 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
 | 
	
 
 
 
 
Install Legacy Pear requirements
	
		
			| 
			pear installConsole_Getopt
 | 
	
 
 
 
 
Firewalld Basic Configuration
You must open port 80 so that you can access the administration interface
	
		
			| 
			firewall-cmd --zone=public --add-port=80/tcp--permanent
 firewall-cmd --reload
 | 
	
 
 
 
 
Enable and Start MariaDB
You must have MariaDB running for freepbx to operate normally.  It must start automatically, and be running continuously.
	
		
			| 
			systemctl enablemariadb.service
 systemctl start mariadb
 | 
	
 
 
 
 
Now that our MariaDB database is running, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit
	
		
			| 
			mysql_secure_installation
 | 
	
 
 
 
 
The prompt will ask you for your current root password. Since you just installed MySQL, you most likely won’t have one, so leave it blank by pressing enter. Then the prompt will ask you if you want to set a root password. Do not set a root password. We secure the database automatically, as part of the install script.  Apart from that you can chose yes for the rest. This will remove some sample users and databases, disable remote root logins, and load these new rules so that MySQL immediately respects the changes we have made.
Enable and Start Apache
FreePBX uses the Apache web server, so this must be started and running.
	
		
			| 
			systemctl enablehttpd.service
 systemctl start httpd.service
 | 
	
 
 
 
 
Install Dependencies for Google Voice (if required)
Install iksemel
 
	
		
			| 
			cd/usr/src
 wget https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
 tarxf iksemel-*.tar.gz
 rm-f iksemel-1.4.tar.gz
 cdiksemel-*
 ./configure
 make
 makeinstall
 | 
	
 
 
 
 
Add the Asterisk User
	
		
			| 
			adduser asterisk -M -c "Asterisk User"
 | 
	
 
 
 
 
Download Asterisk source files.
	
		
			| 
			cd/usr/src
 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-1.4-current.tar.gz
 wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
 wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz
 wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
 | 
	
 
 
 
 
Compile and install DAHDI
	
		
			| 
			cd/usr/src
 tarxvfz dahdi-linux-complete-current.tar.gz
 tarxvfz libpri-1.4-current.tar.gz
 rm-f dahdi-linux-complete-current.tar.gz libpri-1.4-current.tar.gz
 cddahdi-linux-complete-*
 makeall
 makeinstall
 makeconfig
 cd/usr/src/libpri-1.4.*
 make
 makeinstall
 | 
	
 
 
 
 
Compile and install pjproject
	
		
			| 
			cd/usr/src
 tar-xjvf pjproject-2.4.tar.bz2
 rm-f pjproject-2.4.tar.bz2
 cdpjproject-2.4
 CFLAGS='-DPJ_HAS_IPV6=1'./configure--prefix=/usr--enable-shared --disable-sound\
   --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64
 makedep
 make
 makeinstall
 | 
	
 
 
 
 
Compile and Install jansson
	
		
			| 
			cd/usr/src
 tarvxfz jansson.tar.gz
 rm-f jansson.tar.gz
 cdjansson-*
 autoreconf -i
 ./configure--libdir=/usr/lib64
 make
 makeinstall
 | 
	
 
 
 
 
Compile and install Asterisk
	
		
			| 
			cd/usr/src
 tarxvfz asterisk-13-current.tar.gz
 rm-f asterisk-13-current.tar.gz
 cdasterisk-*
 contrib/scripts/install_prereqinstall
 ./configure--libdir=/usr/lib64
 contrib/scripts/get_mp3_source.sh
 makemenuselect
 | 
	
 
 
 
 
You will be prompted at the point to pick which modules to build. Most of them will already be enabled, but if you want to have MP3 support (eg, for Music on Hold), you need to manually turn on 'format_mp3' on the first page.

After selecting 'Save & Exit' you can then continue
	
		
			| 
			make
 makeinstall
 makeconfig
 ldconfig
 chkconfig asterisk off
 | 
	
 
 
 
 
Install Asterisk Soundfiles.
The 'make install' above installs a standard low-quality base sound file by default. This is suitable if you are on a small, underpowered system (such as a Rasberry Pi), but on a larger system you should install higher quality soundfiles. Note that this installs the (8khz) 'wav' soundfiles and G722 (High Definition 'Wideband') audio.
	
		
			| 
			cd/var/lib/asterisk/sounds
 wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
 wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
 tarxvf asterisk-core-sounds-en-wav-current.tar.gz
 rm-f asterisk-core-sounds-en-wav-current.tar.gz
 tarxfz 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-core-sounds-en-g722-current.tar.gz
 wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
 tarxfz asterisk-extra-sounds-en-g722-current.tar.gz
 rm-f asterisk-extra-sounds-en-g722-current.tar.gz
 tarxfz asterisk-core-sounds-en-g722-current.tar.gz
 rm-f asterisk-core-sounds-en-g722-current.tar.gz
 | 
	
 
 
 
 
Set Asterisk ownership permissions.
	
		
			| 
			chownasterisk. /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/
 | 
	
 
 
 
 
A few small modifications 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
 wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz
 tarxfz freepbx-13.0-latest.tgz
 rm-f freepbx-13.0-latest.tgz
 cdfreepbx
 ./start_asteriskstart
 ./install-n
 | 
	
 
 
 
 
That's it!
You can now start using FreePBX.  Open up your web browser and connect to the IP address or hostname of your new FreePBX server.  You will see the Admin setup page, which is where you set your  'admin' account password, and configure an email address to receive update notifications. 
We hope you enjoy using FreePBX 13!