Install freepbx on centos 7 vpsThis article provides a guide for how to install FreePBX on CentOS 7 VPS server.

What is FreePBX?

FreePBX is a web-based, open source GUI (graphical user interface) that controls and manages Asterisk (PBX), an open source communication server. FreePBX, the world’s most popular open source IP PBX, gives users the tools to build a phone system tailored to their needs.
FreePBX is free to download and use, and it’s licensed under the GNU General Public License (GPL). It can operate on-premises or in the cloud. It’s used in a variety of settings, including small companies, multi-location organizations, and call centers.


The following prerequisites are required to install FreePBX on CentOS 7 VPS Server:

  • CentOS VPS server
  • CentOS 7 installed
  • Root user access
  • 2 GB RAM (minimum); 4–8 GB RAM (recommended)
  • 120 GB Storage
  • 1Gbps Port (recommended)

Launch 100% ssd centos vps from $2. 49/mo!

How to Install FreePBX on CentOS 7 VPS Server

To install FreePBX on CentOS 7 VPS server, follow the steps below:

1. Disable selinux

The first step is to disable SELinux (view guide).

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

Verify the selinux status by running ‘sestatus’. It should say:

SELinux status: disabled

2. Update Your System

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

3. Add the Asterisk User

adduser asterisk -m -c "Asterisk User"

4. 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

5. Install Additional Required 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 \

6. Install php 5.6 repositories

rpm -Uvh
rpm -Uvh

7. Install php5.6w

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

8. Install nodejs

curl -sL | bash -
yum install -y nodejs

9. Enable and Start MariaDB

You must have MariaDB running for FreePBX to operate normally. It must start automatically, and be running continuously.

systemctl enable mariadb.service
systemctl start mariadb

Now that our MariaDB database is running, run a simple security script that will remove some dangerous defaults and secure access to your database system.


The prompt will ask you for your current root password. Since you just installed MySQL (or MariaDB), 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.

READ ALSO: How to Install Seafile CE on CentOS VPS

10. Enable and Start Apache

FreePBX uses the Apache web server, so this must be started and running.

systemctl enable httpd.service
systemctl start httpd.service

11. Install Legacy Pear Requirements

pear install Console_Getopt

12. Install and Configure Asterisk

Download Asterisk source files.

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

Asterisk 15

Asterisk 16

13. 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

14. Compile and Install Asterisk

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

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.

READ ALSO: How to Install and Configure LibModsecurity on CentOS 8

If you are using Asterisk 16, enable app_macro.

After selecting ‘Save & Exit’ you can then continue.

make install
make config
chkconfig asterisk off

Set Asterisk ownership 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/

15. Install and Configure FreePBX

Make a few small modifications to Apache:

sed -i 's/\(^upload_max_filesize = \).*/0M/' /etc/php.ini
sed -i 's/^\(User\|Group\).*/ 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

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. By default, FreePBX’s web interface runs on standard web ports (80/443).

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.

Launch 100% ssd centos vps from $2. 49/mo!

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX and Phoenix, AZ.