How can I install FreePBX on CentOS 8 / RHEL 8?.  FreePBX is an open source GUI tool for administering Asterisk PBX systems. It is majorly written in PHP and it can be installed on both Red Hat and Debian Linux family distributions.

In this blog post, we will cover the steps of installing and configuring FreePBX on RHEL / CentOS 8. This setup assumes you have a working installation of Asterisk PBX server. If you don’t have Asterisk PBX server, refer to our guide below.

How to Install Asterisk 16 LTS on CentOS / RHEL 8

Step 1: Update system and set SELinux in enforcing mode

Start work on an up-to-date system.

sudo dnf -y update

If you’re not comfortable with SELinux running in enforcing mode, put it to permissive mode.

sudo setenforce 0
sudo sed -i 's/\(^SELINUX=\).*/\SELINUX=permissive/' /etc/selinux/config

Add EPEL repository using How to Install EPEL repository on RHEL / CentOS 8

Step 2: Install Dependencies

Install Development Tools on RHEL / CentOS server.

sudo dnf -y groupinstall  "Development Tools"

Install other required dependencies:

sudo dnf install -y @php tftp-server ncurses-devel sendmail sendmail-cf newt-devel libxml2-devel libtiff-devel gtk2-devel subversion kernel-devel git crontabs cronie cronie-anacron wget vim php-xml sqlite-devel net-tools gnutls-devel unixODBC

Step 3:  Install MariaDB Database server:

FreePBX requires a database server for configurations and data storage. Use the guide on the link below to install and configure MariaDB Database server.

How to Install MariaDB on RHEL / CentOS 8

Step 4: Installing Node.js 10 LTS

FreePBX has Node.js as a dependency, install it on your system by using our guide below:

How to Install Node.js 10 LTS on RHEL / CentOS 8

Step 5: Install and configure Apache Web Server

Install httpd package using yum package manager:

sudo dnf -y install @httpd

Remove default index.html page

sudo rm -f /var/www/html/index.html

Start and enable httpd service to start at boot.

sudo systemctl enable --now httpd

If you have an active firewalld firewall service, open http & https ports

sudo firewall-cmd --add-service={http,https} --permanent
sudo firewall-cmd --reload

Step 6: Install PHP and required extensions

FreePBX is dependent on PHP, run the following commands to install php and required extensions.

sudo dnf -y install wget @php php-pear php-cgi php-common php-curl php-mbstring php-gd php-mysqlnd php-gettext php-bcmath php-zip php-xml  php-json php-process php-snmp
Change php maximum file upload size:
sudo sed -i 's/\(^upload_max_filesize = \).*/\10M/' /etc/php.ini

Start php-fpm and httpd.

sudo systemctl enable --now php-fpm httpd
sudo systemctl restart php-fpm httpd

Verify the status of two services.

$ sudo systemctl status php-fpm httpd
php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2019-03-23 21:26:53 EAT; 11s ago
Main PID: 29086 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 6 (limit: 11510)
Memory: 22.8M
CGroup: /system.slice/php-fpm.service
├─29086 php-fpm: master process (/etc/php-fpm.conf)
├─29087 php-fpm: pool www
├─29088 php-fpm: pool www
├─29089 php-fpm: pool www
├─29090 php-fpm: pool www
└─29091 php-fpm: pool www
Mar 23 21:26:53 rhel8.local systemd[1]: Starting The PHP FastCGI Process Manager…
Mar 23 21:26:53 rhel8.local systemd[1]: Started The PHP FastCGI Process Manager.
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf
Active: active (running) since Sat 2019-03-23 21:26:54 EAT; 10s ago
Docs: man:httpd.service(8)
Main PID: 29095 (httpd)
Status: "Running, listening on: port 443, port 80"
Tasks: 213 (limit: 11510)
Memory: 31.0M
CGroup: /system.slice/httpd.service
├─29095 /usr/sbin/httpd -DFOREGROUND
├─29096 /usr/sbin/httpd -DFOREGROUND
├─29097 /usr/sbin/httpd -DFOREGROUND
├─29098 /usr/sbin/httpd -DFOREGROUND
└─29099 /usr/sbin/httpd -DFOREGROUND
Mar 23 21:26:54 rhel8.local systemd[1]: Starting The Apache HTTP Server…
Mar 23 21:26:54 rhel8.local httpd[29095]: Server configured, listening on: port 443, port 80
Mar 23 21:26:54 rhel8.local systemd[1]: Started The Apache HTTP Server.

Step 7: Download and Install FreePBX on CentOS 8 / RHEL 8

Download the latest version of FreePBX 14 LTS:

wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-14.0-latest.tgz

Extract the file:

tar xfz freepbx-14.0-latest.tgz

Install FreePBX on CentOS / RHEL 8.

cd freepbx
sudo ./start_asterisk start
sudo ./install -n

If you have a root password for database server, use:

sudo ./install -n --dbuser root --dbpass password

Replace password with the root database password. Below is a sample installation output:

Restart httpd.

sudo systemctl restart httpd

Step 8: Access FreePBX Web Interface

Open your web browser and connect to the IP address or hostname of your new FreePBX server.

1. Create the first admin account

2. When done providing admin user details, click “Create Account” to create the account. On the next page, you’ll get a login console.

You’ll get to FreePBX dashboard where you can manage your Asterisk PBX. You now have FreePBX installed on RHEL / CentOS 8 server.