How to install Hubzilla

A HowTo using Ubuntu 18.04 LTS

Hubzilla is an open-source platform to create interconnected websites that feature a decentralized identity, communications, and permissions framework built using webserver technology. Hubzilla servers communicate with one another in order to propagate the information across the network; due this this we have a decentralized network. As there is no single or central hub.

In this tutorial, I will be installing and setting up Hubzilla on server provided by Wishosting.com. As mentioned on LowendTalk.com, if you are looking for low cost alternatives to run a site and not break the bank. Many providers out there this site is the place to get an honest review. Let's move on.

Prerequisites

  • You must have someplace to host the site. This can either be on a self-hosted box in your home. Or an instance one of the many cloud providers. As mentioned above or OVH, Kimsufi, Scaleway, AWS, etc. If you just want to test the waters you can get a free account on many of the major providers. But I like to support the little guy myself, and since the point is to be decentralized...Why a dependency on the big guys? Where ever you host, your instance must have at least 1GB RAM and 1 Core processor.

  • A domain name registered for your site. If you have already registered a domain from a host, you can update its domain nameserver records.

  • The Domain name (A Record) must be pointed to your instances IP address.

  • Access to console into your instance via SSH or VNC.

  • The ability to set up your server's hostname and create a user with root privileges.

Setting Up Your Server

Before proceeding with installation of any packages, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges.

#sudo apt update && sudo apt upgrade

You will need to install Git on your server. To install and configure Git, execute the command below

# sudo apt-get install git

(Optional) Now execute the commands below to configure Git by providing your name and valid email address so that commit messages may contain your correct information.

# git config --global user.name "G.Love"

# git config --global user.email "[email protected]"

Install PHP

Paste requires installation of PHP 5.6 or newer version of PHP. In this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.

First, you will need to install Python software properties and software properties common. To do so, execute the command below.

# sudo apt-get install software-properties-common python-software-properties

You will need to add repository for newer versions of PHP. To do so, execute the commands below.

# sudo add-apt-repository ppa:ondrej/php

Then, update the system to refresh the available repositories. To do so, execute the command for updating Ubuntu system.

# sudo apt update

Let's install PHP 7.2. To install PHP 7.2, execute the following command.

# sudo apt install -y php7.2

Hubzilla requires the following PHP extensions:

  1. php7.2-cli
  2. php7.2-fpm
  3. php7.2-mbstring
  4. php7.2-gd
  5. php7.2-xml
  6. php7.2-mysql
  7. php7.2-curl
  8. php7.2-zip
  9. php7.2-json

To install the above extensions of PHP, execute the following command.

# sudo apt install -y php7.2-mysql php7.2-curl php7.2-json php7.2-cli php7.2-gd php7.2-xml php7.2-mbstring php7.2-fpm php7.2-zip

Confirm Installation!

To check PHP installation, you can execute the following command to check installed PHP version.

# php --version

Install MariaDB

Hubzilla supports MySQL and PostgreSQL. In this tutorial, we use the MariaDB server. By default, the Ubuntu repository has an older version of the MariaDB server. To use the new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.

Obtain the keys by executing the command:

# sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Add the repository using the command.

# sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu bionic main'

Update the system by using command.

# sudo apt update

Install MariaDB using the following command.

'# sudo apt install -y mariadb-server'

Start and enable the MariaDB server so that after reboot, the server can start automatically.

# sudo systemctl start mariadb

# sudo systemctl enable mariadb

Run the following command to enhance security of MariaDB server and set password for the root user.

# sudo mysql_secure_installation

Connect to the MySQL shell as root user using the command below and enter your password.

# sudo mysql -u root -p

Execute the following MySQL queries in your MariaDB server.

` CREATE DATABASE hub;

CREATE USER 'aareez'@'localhost' IDENTIFIED BY '654321Ab';

GRANT ALL PRIVILEGES ON hub.* TO 'aareez'@'localhost';

FLUSH PRIVILEGES;

EXIT;

`

Install Hubzilla

To install Hubzilla, you will need to follow the steps.

Navigate to /var/www using the command.

# cd /var/www

Clone Hubzilla from Github using the command below.

# sudo git clone https://framagit.org/hubzilla/core.git hubzilla

Navigate to /hubzilla using the command.

# cd hubzilla

Create directory for storing data of Hubzilla by executing command below.

'# sudo mkdir -p "store/[data]/smarty3"'

Change rights for the directory created in the step above.

# sudo chmod -R 777 store

Install Hubzilla Addons

To clone and install Hubzilla addons, execute the following command.

# sudo util/add_addon_repo https://framagit.org/hubzilla/addons.git hzaddons

# sudo util/update_addon_repo hzaddons

Now provide ownership of /var/www/hubzilla to www-data so that NGINX server can access the required files.

# sudo chown -R www-data:www-data /var/www/hubzilla

Configure Apache Server

Let's create virtual host configuration file for Hubzilla. Execute the following command, a file will be opened in nano text editor.

# sudo nano /etc/apache2/sites-available/hubzilla.conf

Copy and paste the following code and save the file.

`<VirtualHost *:80>

ServerAdmin [email protected]

ServerName ben10.fun

DocumentRoot /var/www/hubzilla

DirectoryIndex index.php index.htm index.html

<Directory />

    Options FollowSymLinks

    AllowOverride All

</Directory>

<Directory /var/www/>

    Options Indexes FollowSymLinks MultiViews

    AllowOverride All

    Order allow,deny

    allow from all

</Directory>

ErrorLog ${APACHE_LOG_DIR}/hubzilla_error.log

LogLevel warn

CustomLog ${APACHE_LOG_DIR}/hubzilla_access.log combined

`

Execute the command below to disable default site.

# sudo a2dissite 000-default.conf

You will need to enable the newly-created virtual host. To do so, execute the command below.

# sudo a2ensite hubzilla

You will also need to enable rewrite mod. You can do so by editing the configuration file in the apache2 directory or you can simply execute the command below.

# sudo a2enmod rewrite

Now you will need to enable SSL engine. You can do so by editing the configuration file in the apache2 directory or you can simply execute the command below.

# sudo a2enmod ssl

Restart Apache server to apply the changes and load the settings by executing command below.

# sudo service apache2 restart

Now you can access Hubzilla via your domain name or instances IP address. You will see the following screen.

`

                                    3
Configure Database

When you click Next, you will be redirected to the following screen.

                                    4

Add the database details and hit the Submit button. You will be redirected to following page. If you want to setup SSL then go to next section to install SSL and continue from 		here. Otherwise, fill in the details asked and hit Submit to continue.

                                    5

After submission, you will see the following screen.

                                    6

You have successfully installed Hubzilla on your server.

`

Install an SSL Certificate

To install SSL certificate using Let's Encrypt, you will use Certbot. To do so, execute the following steps.

Update the package using command.

# sudo apt-get update

To install software-properties-common, execute the command below.

# sudo apt-get install software-properties-common

Add the certbot repository by using command below.

# sudo add-apt-repository ppa:certbot/certbot

Update the package to load the added certbot repository using command.

# sudo apt-get update

Stop apache before issuance of SSL certificate.

# sudo systemctl stop apache2

Install python-certbot-apache using the command below.

# sudo apt-get install python-certbot-apache

Execute the following command to get let's encrypt SSL issued.

# sudo certbot --apache -d love1another.com

Select the option 2 to redirect the link to https and update virtual host settings for SSL. `

                                    7

After the successful issuance of SSL certificate, you will see the following screen.

                                    8

Restart apache server.

# sudo systemctl start apache2

At this point you can now navigate to your instance using https:.

Set Up Firewalls for Required Ports

If you have activated a firewall which you should have! You will have to define a rule in your Hubzilla server to allow port 80/tcp and 443/tcp. Normally the default is that these ports are blocked.

You can now enjoy you instance and let the learning begin! Make sure the first hing you do is make a backup of your hard work before you make any changes!

I would like to give a thanks to Hubzilla Rocks! for establishing the original documentation that sent me down this road. And for putting up with all my questions along the way! THANK YOU!

-- G. Love