How To install Flarum Forum software on Ubuntu 22.04 | 20.04

Do you want to host your own discussion forum software? Then here is the tutorial to install and configure Flarum on Ubuntu 20.04 Focal or Ubuntu 22.04 Jammy Jellyfish.

Flarum is the combined successor of esoTalk and FluxBB forums. It is a newbie in the forums world but still one of the best forum interfaces along with a sleek and modern look.  The user interface is simple, fast, and free from clutter and bloats. Flarum is built with PHP so it’s quick and easy to deploy.

The interface is powered by Mithril, a performant JavaScript framework with a tiny footprint. Right now to installation this forum you need SSH access to the hosting server and install the composer. This forum is still in the beta stage so before using it for production you need to give it some time. But still, for your own experience, you can install and use it. After stable release, it can be proved the best alternative to the Discourse forum.

Flarum Opensource Features:

Beautiful and responsive design
• Themeable
• Dynamic notifications
• SEO optimized
• Touch devices optimized
• Tags, replies, and mentions
• Real-time discussion

Steps to install Flarum Forum discussion platform on Ubuntu 22.04 | 20.04 LTS

1. Requirements:

To install Flarum, we need the following things:

Ubuntu 18.04, 20.04, or 22.04 Server
Apache or Nginx webserver
PHP 7.3+
MySQL 5.6+ or 8.023 + or MariaDB 10.0.5+
A non-root user with sudo access

 

2. Run system Ubuntu 20.04 or 22.04 update

Before moving further, let’s make sure everything on our system is up to date. Also, along with that install some other tools we will require further in this tutorial.

sudo apt update && sudo apt upgrade -y
sudo apt install wget unzip curl nano git -y

 

2. Install Apache webserver for Flarum

Here we are using the common Apache web server on Ubuntu 20.04 or 22.04 to install Flarum Forum. Hence, if you don’t have it already, use the given command to install it.

sudo apt install apache2 -y

Start and enable the service:

sudo systemctl enable --now apache2

Enable mod_rewrite

sudo a2enmod rewrite

Restart apache2:

sudo systemctl restart apache2

 

3. Install MySQL/MariaDB and PHP

As Flarum is a PHP-based web forum application, hence we need to set up PHP on our Ubuntu 20.04 or 22.04 Linux along with some extensions required by the software. The default version of PHP is available through the base repository of Ubuntu 20.04 is 7.4.

sudo apt install php php-{curl,dom, gd,json,mbstring,msqli,tokenizer,zip}

 

Next, install the MariaDB Database server:

sudo apt install mariadb-server -y

Start and enable its service:

sudo systemctl enable --now mariadb

To secure a Database server use this command and follow the text wizard:

sudo mysql_secure_installation

 

4. Create Database for Flarum

We require a database to store the data generated by the Flarum forum, hence, for that create one on your MariaDB server.

Login to MariaDB command line:

sudo mysql -u root -p

Enter the password you have created for it while securing.

Run the following command to create the database:

Change the yourdb with whatever name you want to give to your database and in the same way, replace youruser and yourpassword with username and password, you want to assign to your Database user.

CREATE DATABASE yourdb;
CREATE USER 'youruser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON yourdb. * TO 'youruser'@'localhost';
FLUSH PRIVILEGES;
exit;

 

5. Install composer to get Flarum on Ubuntu 20.04 | 22.04

The easiest way to install Flarum is to use a composer that will resolve and install the PHP dependencies required by the Flarum. Hence, just download the composer to set it up.

curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

To confirm Composer on our system use:

composer -V

 

Install Composer

 

6. Setup Flarum for Apache on Ubuntu 22.04 | 20.04

Once the Composer is on your system, use it to download its file to the web directory that you want to use to access the Flarum forum.

Create a directory in your webroot folder: Here it is ‘forum‘.

sudo mkdir /var/www/html/forum/

Now switch to the created directory.

cd /var/www/html/forum/

 

Install Flarum:

Inside the Web directory run the given command to install Flarum files.

sudo composer create-project flarum/flarum . --stability=beta

Setup Flarum on Ubuntu 20.04 using composer

Once the installation is completed, give the directory permission to the Apache user:

sudo chown -R www-data:www-data /var/www/html/forum/
sudo chmod -R 755 /var/www/html/forum/

 

7. Create a Virtual host configuration file

Most of the time we either use Forums on sub-domain or Sub-folder, hence for that create a virtual host configuration file.

sudo nano /etc/apache2/sites-available/flarum.conf

Add the following lines:

<VirtualHost *:80>
ServerAdmin [email protected]example.com
DocumentRoot /var/www/html/forum/public
ServerName forum.example.com

DirectoryIndex index.php

<Directory /var/www/html/forum/public/>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
allow from all

</Directory>

ErrorLog /var/log/apache2/flarum-error_log
CustomLog /var/log/apache2/flarum-access_log common

</VirtualHost>

Replace the domain name example.com as per your domain, if you have, otherwise you still be able to access the forum using the IP address.

Save the file by pressing Ctlr+O, hit the Enter key, and then exit- Ctrl+X.

Those who are using a fresh server and want to access the Forum on the root domain, also need to disable the default configuration file:

sudo a2dissite 000-default.conf

Reload Apache:

sudo systemctl reload apache2

 

8. Access Forum Web Interface

Now, open any browser that can either access the IP address of the server or the domain where you have installed the Flarum Forum.

http://server-ip-address/ 

or

http://forum.example.com/ 

Those who are using subdomain– can go for that only.

 

9. Flarum web Setup and configuration

1. Add Database details and create Admin User

On the first screen, the Flarum setup will ask you to enter the details of the database you have created. Along with that also create an Admin user to log in to the Forum backend later after setting up the software.

 

Create Admin USer for Flarum

 

2. Forum web interface

You will have the Interface of the forum which is like Discourse to start commenting.

Flarum Forum install Ubuntu 20.04 or 22.04

Linux forum software

 

3. Admin Dashboard

To get the Admin settings for controlling commenting system, users, moderator, and other settings; click on the Profile icon and select the Administrator option.

Flarum Forum Admin Dashboard

 

10. For installing Let’s Encrypt SSL

sudo apt-get install python3-certbot-apache -y
sudo certbot --apache -d forum.example.com

And follow the wizard.

 

Other Articles:

How To Install Discourse on Debian 11 Bullseye server
Install LXQt Desktop Environment on Ubuntu 22.04
3 Ways to install Inkscape on Ubuntu 20.04 | 22.04
How to install Gnome 41 in Ubuntu 20.04

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.