How To Install FreePBX 16 on CentOS 8 / RHEL 8

ComputingPost
5 min readNov 3, 2022

--

How can I install FreePBX 16 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 16 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.

Step 1 — Update system and set SELinux in permissive

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

CentOS 8:

sudo yum -y install epel-release

sudo yum config-manager --set-enabled powertools

RHEL 8:

sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

ARCH=$( /bin/arch )

sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-$ARCH-rpms

Step 2 — Install FreePBX Dependencies

Install Development Tools on RHEL / CentOS server.

sudo dnf -y groupinstall "Development Tools"

Install other required dependencies:

sudo dnf install -y 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  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.

Step 4 — Installing Node.js LTS

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

sudo dnf -y module install nodejs

Confirm installation was successful:

$ node --version

v10.24.0

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

sudo rm /etc/httpd/conf.d/welcome.conf

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

Add EPEL and REMI repositories:

sudo dnf -y install yum-utils

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

sudo dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

sudo dnf module -y reset php

sudo dnf module -y install php:remi-7.4

Run the command below to install required php extensions which are needed to run FreePBX.

sudo dnf install -y 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



sudo pear install Console_Getopt

Set the maximum upload size for php

sudo sed -i 's/\(^upload_max_filesize = \).*/\l20M/' /etc/php.ini

sudo sed -i 's/\(^upload_max_filesize = \).*/\1128M/' /etc/php.ini

and set upload_max_filesize = 20M and proceed to start php-fpm and httpd.

sudo systemctl restart php-fpm httpd

sudo systemctl enable php-fpm httpd

Verify the status of two services.

$ 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 2022-04-13 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 2022-04-13 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 — Install FreePBX 16 on CentOS 8 / RHEL 8

Before installing FreePBX, make the following modifications for Apache

sudo sed -i 's/\(^memory_limit = \).*/\1128M/' /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 sed -i 's/\(^user = \).*/\1asterisk/' /etc/php-fpm.d/www.conf

sudo sed -i 's/\(^group = \).*/\1asterisk/' /etc/php-fpm.d/www.conf

sudo sed -i 's/\(^listen.acl_users = \).*/\1apache,nginx,asterisk/' /etc/php-fpm.d/www.conf

Download the latest version of FreePBX 16 LTS:

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

Extract the file:

tar xfz freepbx-16.0-latest.tgz

Install FreePBX on CentOS / RHEL 8.

cd freepbx

sudo systemctl stop asterisk

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:

freepbx-install-rhel-centos8-1024x492

Install all Freepbx modules

sudo fwconsole ma disablerepo commercial

sudo fwconsole ma installall

sudo fwconsole ma delete firewall

sudo fwconsole reload

sudo fwconsole restart

Restart httpd.

sudo systemctl restart httpd php-fpm

Create FreePBX systemd (startup script)

Create a systemd unit for auto-starting the service:

sudo tee /etc/systemd/system/freepbx.service<[Unit]

Description=FreePBX VoIP Server

After=mariadb.service

[Service]

Type=oneshot

RemainAfterExit=yes

ExecStart=/usr/sbin/fwconsole start -q

ExecStop=/usr/sbin/fwconsole stop -q

[Install]

WantedBy=multi-user.target

EOF

Enable the service to autostart

sudo systemctl daemon-reload

sudo systemctl enable freepbx

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

install-freepbx-ubuntu-18.04-set-username-min (2)

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

freepbx-15-ubuntu-18.04-debian-9-login (1)

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

https://www.computingpost.com/how-to-install-freepbx-16-on-centos-8-rhel-8/?feed_id=17786&_unique_id=63640abc8ca8d

--

--

ComputingPost
ComputingPost

Written by ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.

No responses yet