Installing Freepbx on Alpine Linux

FreePBX is an open-source web-based graphical user interface (GUI) for managing Asterisk PBX server. Alpine Linux is a lightweight Linux distribution popular for its security and simplicity. In this tutorial, we will go through the steps to install Freepbx on Alpine Linux Latest.

Prerequisites

Before we begin, make sure you have:

Installing Required Packages

First, we need to install some necessary packages for Freepbx to run on our system. Open a terminal and enter the following command:

sudo apk update
sudo apk add asterisk asterisk-dev apache2 php7 php7-apache2 mariadb mariadb-client mariadb-server mariadb-dev

This will install Asterisk, Apache web server, PHP and MariaDB database server on your system.

Downloading and Installing Freepbx

Download the latest version of Freepbx from the official website https://www.freepbx.org/downloads/ and extract the contents:

cd /tmp
sudo wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-latest.tgz
sudo tar xvzf freepbx-latest.tgz

Move the extracted contents to the Apache web server document root directory:

sudo mv freepbx /var/www/localhost/htdocs

Give ownership of the directory to the Apache user:

sudo chown -R apache:apache /var/www/localhost/htdocs/freepbx

Configuring MariaDB database

Next, we need to configure and create a database for Freepbx to use. Start by securing the MariaDB server:

sudo mysql_secure_installation

Enter a root password for the MariaDB server and answer the prompts to increase security.

Log in to the MariaDB server as root:

sudo mysql -u root -p

Create a new user and grant privileges to the user:

CREATE USER 'freepbxuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON asterisk.* TO 'freepbxuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Configuring and Starting Asterisk

Asterisk needs to be configured and started for Freepbx to work correctly. Copy the default configuration files:

sudo cp /etc/asterisk/{sip.conf,extensions.conf} /etc/asterisk/{sip.conf.orig,extensions.conf.orig}

Create a symlink to the Asterisk sample configuration files:

sudo ln -sf /var/www/localhost/htdocs/freepbx/admin/modules/core/etc/asterisk/* /etc/asterisk

Set ownership of the /var/spool/asterisk directory:

sudo chown -R asterisk:asterisk /var/spool/asterisk

Start the Asterisk service:

sudo rc-update add asterisk
sudo rc-service asterisk start

Final Steps

We need to configure the Apache web server to serve Freepbx on the web:

sudo sed -i 's/^\(DocumentRoot.*\)$/\1\/freepbx/' /etc/apache2/httpd.conf

Restart the Apache web server:

sudo rc-service apache2 restart

You can now access Freepbx by navigating to http://your-ip-address/freepbx in your web browser. Follow the on-screen instructions to complete the installation.

Conclusion

In this tutorial, we went through the steps to install and configure Freepbx on Alpine Linux Latest. Now you can use this powerful GUI to manage your Asterisk PBX server with ease.

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!

Alternatively, for the best virtual desktop, try Shells!