Flarum

Flarum

Flarum is a lightweight, modern, open-source forum platform designed to provide a fast and responsive online community experience. Flarum is built with PHP on the backend and uses Mithril.js on the frontend, offering an interactive and user-friendly interface.

Key Features of Flarum:

  • User-friendly: A clean and intuitive interface for community discussions.
  • Mobile-ready: Fully responsive and optimized for mobile devices.
  • Extensible: Supports various extensions to add features as needed.
  • Fast Performance: Built for speed with a lightweight footprint.

Flarum is a popular choice for communities seeking a modern discussion forum, with features like real-time notifications, user mentions, and a flexible category system.

1. System Requirements

System requirements for running Flarum 1.8:

  • Apache with mod_rewrite or Nginx
  • PHP 7.3+ with extensions: curl, dom, fileinfo, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
  • MySQL 5.6+/8.0.23+ or MariaDB 10.0.5+

Before starting deployment, prepare:

  • VPS or server with Ubuntu 24.04 LTS OS
  • SSH access to the server
  • A domain already pointed to the server

2. Server Preparation

Update the system

sudo apt update
sudo apt upgrade -y

Install Apache

sudo apt install apache2 -y

Add the PPA ondrej/php repository

sudo add-apt-repository ppa:ondrej/php -y
sudo apt upgrade -y

Install PHP 8.3 and required extensions

sudo apt install php8.3 php8.3-cli php8.3-common \
  php8.3-apcu php8.3-mbstring php8.3-gd php8.3-intl \
  php8.3-xml php8.3-soap php8.3-bcmath php8.3-mysql php8.3-zip \
  php8.3-curl php8.3-tidy php8.3-imagick php8.3-sqlite3 -y

Install Composer

sudo wget https://getcomposer.org/download/latest-stable/composer.phar -O /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

Install MariaDB

sudo apt install mariadb-server -y

3. Create Database

Log in to MariaDB

sudo mysql

Create database and user

CREATE DATABASE flarum;
CREATE USER 'flarum'@'localhost' IDENTIFIED BY 'rahasia';
GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost';
FLUSH PRIVILEGES;
exit

4. Apache Configuration

Create a virtual host configuration for forum.contoh.com

sudo nano /etc/apache2/sites-available/forum.contoh.com.conf	

Enter the configuration

<VirtualHost *:80>
    ServerName forum.contoh.com
    DocumentRoot /var/www/forum.contoh.com/public
    <Directory /var/www/forum.contoh.com/public>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/apache2/forum.contoh.com_error.log
    CustomLog /var/log/apache2/forum.contoh.com_access.log combined
</VirtualHost>

Enable the rewrite module, virtual host, and restart apache2

sudo a2enmod rewrite
sudo a2ensite forum.contoh.com
sudo systemctl restart apache2	

Install Certbot

sudo apt install certbot python3-certbot-apache -y	

Request SSL certificate

sudo certbot --non-interactive \
    -m [email protected] \
    --agree-tos \
    --no-eff-email \
    --apache -d forum.contoh.com \
    --redirect	

5. Install Flarum

Create a Flarum project with composer

sudo composer create-project flarum/flarum:^1.8.0 /var/www/forum.contoh.com

Change directory and install extension-manager

cd /var/www/forum.contoh.com
sudo composer require flarum/extension-manager:"*" /var/www/forum.contoh.com

Change the directory’s user-group

sudo chown -R www-data:www-data /var/www/forum.contoh.com

Access https://forum.contoh.com to install Flarum.

Enter:

  1. Forum Title
  2. MySQL Database
  3. MySQL Username
  4. MySQL Password
  5. Admin Username
  6. Admin Email
  7. Admin Password
  8. Confirm Password

Finally, click Install Flarum.

Flarum deployment is complete and ready to use.