How to Install Freepbx on OpenBSD

This tutorial will guide you through the steps to install Freepbx, a freely available open-source PBX software that features voice over IP services for OpenBSD. We assume that you have a fresh installation of OpenBSD and access to a terminal with administrative privileges.

Step 1: Update OpenBSD

We recommend that you upgrade your system to ensure that you have the latest patches and upgrades. Run the following command:

# sysupgrade

Step 2: Install Dependencies

Before we start with the installation of Freepbx, we need to install some required dependencies. Run the following command to install all the relevant dependencies:

# pkg_add -v apache mariadb-server mariadb-client php php-pdo_pgsql php-pdo_mysql php-pgsql php-pdo_odbc php-ldap php-imap php-curl php-gd php-mbstring

Step 3: Create a Database for Mariadb

Freepbx requires a database to store its configurations and data. In this step, you will create a database and a user to access it:

# mysql_secure_installation

This will prompt you to set a root password and configure some security options. Next, log in to the Mariadb server:

# mysql -u root -p

Create a database and user for Freepbx:

CREATE DATABASE freepbx;
CREATE USER 'freepbxuser'@'localhost' IDENTIFIED BY 'freepbxpass';
GRANT ALL PRIVILEGES ON freepbx.* TO 'freepbxuser'@'localhost';
FLUSH PRIVILEGES;
quit;

Step 4: Install Freepbx

Download and extract the latest version of Freepbx:

# cd /usr/local/src
# ftp https://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
# tar xfz freepbx-15.0-latest.tgz

Move the extracted files to the Apache web directory:

# mv /usr/local/src/freepbx /var/www/htdocs/

Set the file permissions:

# chown -R www:www /var/www/htdocs/freepbx

Step 5: Configure Apache and PHP

In this step, you will configure Apache to allow access to Freepbx and enable the required PHP extensions. Edit the Apache configuration file:

# vi /etc/httpd.conf

Add the following lines at the bottom of the file:

DocumentRoot "/var/www/htdocs"
<Directory "/var/www/htdocs/freepbx">
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Save and exit the file. Next, edit the PHP configuration file:

# vi /etc/php-fpm.conf

Add the following lines at the bottom of the file:

extension=pdo.so
extension=pdo_mysql.so
extension=pdo_pgsql.so
extension=pdo_odbc.so
extension=mysqli.so
extension=ldap.so
extension=sockets.so

Save and exit the file.

Step 6: Start the Required Services

Enable and start the required services:

# rcctl enable httpd
# rcctl start httpd
# rcctl enable mariadb
# rcctl start mariadb

Step 7: Finalize the Installation

Open your web browser and go to http://localhost/freepbx. Follow the on-screen instructions to complete the installation.

Once the installation is complete, remove the installation directory:

# rm -rf /var/www/htdocs/freepbx/install

Congratulations! You have now installed Freepbx on OpenBSD.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!