This brief tutorial shows students and new users how to install FreePBX on Ubuntu 18.04 | 16.04.
FreePBX is an opensource, web based application that can be used to manage Asterisk (PBX) platform. We recently showed you how to install Asterisk on Ubuntu.
When you install Asterisk, you’ll get a terminal console where you can manage the system. The problem with managing Asterisk via the terminal is, it can be very difficult to configure complicated phone trees via the terminal.
For a simple to use interface, install FreePBX. This post is going to show you how to install FreePBX to manage Asterisk.
To get started with managing FreePBX, follow the steps below:
Step 1: Install Asterisk PBX
Since you’re going to be managing Asterisk, you first task will be to install it. The good thing is, we’ve shown our users how to install Asterisk on Ubuntu.
Below is a tutorial that showed you how to install Asterisk on Ubuntu.
After installing Asterisk above, continue below to installing and configuring FreePBX.
Step 2: Apache2 HTTP Server
Apache2 HTTP Server is the most popular web server in use. so install it since FreePBX needs it.
To install Apache2 HTTP on Ubuntu server, run the commands below.
sudo apt update sudo apt install apache2
After installing Apache2, the commands below can be used to stop, start and enable Apache2 service to always start up with the server boots.
sudo systemctl stop apache2.service sudo systemctl start apache2.service sudo systemctl enable apache2.service
To find out if Apache2 HTTP server is installed, simply open your web browser and type in the server’s IP or hostname.
When you see the page similar to the one below, then Apache2 is installed and working.
After that, run the commands below to remove Apache2 default index.html file.
sudo rm /var/www/html/index.html
Step 3: Install MariaDB Database Server
FreePBX also needs a database server to store its content. and MariaDB database server is a great place to start when looking at open source database servers to use with FreePBX.
To install MariaDB run the commands below.
sudo apt install mariadb-server mariadb-client
After installing MariaDB, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.
Run these on Ubuntu
sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service
After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access.
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
Restart MariaDB server
To test if MariaDB is installed, type the commands below to logon to MariaDB server
sudo mysql -u root -p
To test if MariaDB is installed and working, run the commands below:
sudo systemctl status mariadb
That should display MariaDB service status.
● mariadb.service - MariaDB 10.1.44 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-04-08 17:08:17 CDT; 1min 54s ago
Docs: man:mysqld(8)
Main PID: 22363 (mysqld)
Status: "Taking your SQL requests now…"
Tasks: 27 (limit: 4666)
CGroup: /system.slice/mariadb.service
└─22363 /usr/sbin/mysqld
Apr 08 17:08:17 ubuntu1804 /etc/mysql/debian-start[22396]: mysql
By default on Ubuntu, MariaDB is configured to use the UNIX auth_socket plugin. You’ll want to run the SQL commands below for the root user to use mysql_native_password.
You’ll need MariaDB root account to setup FreePBX later.
Run the commands below to logon to MariaDB. When prompted for a password, type the root password you created above.
sudo mysql -u root -p
Switch to the myql database.
use mysql;
Then update the root account to use mysql_native_password.
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User="root";
Finally, save your changes and exit.
FLUSH PRIVILEGES; EXIT;
Step 4: Install PHP 7.2 and Related Modules
PHP 7.2 may not be available in Ubuntu default repositories. in order to install it, you will have to get it from third-party repositories.
Run the commands below to add the below third party repository to upgrade to PHP 7.2
sudo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php
Then update and upgrade to PHP 7.2
sudo apt update
Next, run the commands below to install PHP 7.2 and related modules.
sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-imap php7.2-ldap php-cas php7.2-bcmath php7.2-xml php7.2-cli php7.2-zip php7.2-sqlite3
After installing PHP 7.2, run the commands below to open PHP default config file for Apache2.
sudo nano /etc/php/7.2/apache2/php.ini
Then make the changes on the following lines below in the file and save. The value below are great settings to apply in your environments.
file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 256M upload_max_filesize = 100M max_execution_time = 360 max_input_vars = 1500 date.timezone = America/Chicago
After making the change above, save the file and close out.
To test PHP 7.2 settings with Apache2, create a phpinfo.php file in Apache2 root directory by running the commands below
sudo nano /var/www/html/phpinfo.php
Then type the content below and save the file.
<?php phpinfo( ); ?>
Save the file. then browse to your server hostname followed by /phpinfo.php
/phpinfo.php
You should see PHP default test page.
Step 5: Install Nodejs
After installing the server above, run the commands below to add Nodejs 10 repository to Ubuntu
sudo apt update
sudo apt install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL | sudo bash
Then run the commands below to install Nodejs.
sudo apt-get install gcc g++ make
sudo apt install nodejs
Step 6: Install FreePBX
At this point, you should have everything ready fro FreePBX. To download and install FreePBX, run the commands below:
sudo apt install wget
cd /tmp
wget
tar xfz freepbx-15.0-latest.tgz
Finally, run the commands below to install.
cd freepbx
sudo ./start_asterisk start
sudo ./install -n --dbuser root --dbpass type_root_password_here
If you get an error,
Error!
Unable to read /etc/asterisk/asterisk.conf or it was missing a directories section
run the commands below to resolve:
sudo cp /etc/asterisk/asterisk.conf.old /etc/asterisk/asterisk.conf
If you also get an error:
‘asterisk’ user…bash: line 0: cd: /home/asterisk/: No such file or directory
Run the commands below to resolve:
sudo mkhomedir_helper asterisk
When you have resolved all the errors above, go back and try the installation again.
After installing, you should get similar message as shown below:
Updating Hooks…Done Done installing all modules Taking too long? Customize the chown command, See Setting Permissions… Setting base permissions…Done Setting specific permissions… 11864 [============================] Finished setting permissions Taking too long? Customize the chown command, See Setting Permissions… Setting base permissions…Done Setting specific permissions… 11864 [============================] Finished setting permissions Generating default configurations… Finished generating default configurations You have successfully installed FreePBX
After installing, restart Apache2.
sudo a2enmod rewrite
sudo usermod -aG www-data asterisk
sudo systemctl restart apache2
Now go and access FreePBX portal.
Setup, login and start building your own PBX
That’s it!
Conclusion:
This post showed you how to install Asterisk and FreePBX to create your own PBX systems. If you find any error above, please use the comment form below to report.
Thanks,
You may also like the post below: