Come hang with us on Discord and chat directly with the team!Discordtop-bar-close-icon

2024-09-04

How to Install Flarum on Debian Latest

tutorials
img

Learn how to set up Flarum, a dynamic open-source forum software, on Debian for a seamless community experience.

In this guide, we'll walk you through the process of installing Flarum on Debian, a robust platform known for its speed and user-friendly interface.

Prerequisites

Ensure your system is prepared with the following prerequisites:

  • Server running Debian 10 or newer
  • Non-root user with sudo access

Step 1: Install Required Packages

Begin by updating your Debian system's package index and installing necessary packages:

sudo apt update
sudo apt install git curl zip unzip software-properties-common -y

Step 2: Install Apache Web Server

Proceed by setting up the Apache web server:

sudo apt install apache2 -y

After installation, start and enable Apache:

sudo systemctl start apache2
sudo systemctl enable apache2

Step 3: Install PHP and Required Extensions

Install PHP along with necessary extensions. Flarum requires PHP 7.3 or higher:

sudo apt install php php-mysql php-json php-curl php-mbstring php-xml php-zip php-gd -y

Verify the PHP version:

php -v

Step 4: Install MariaDB

For database management, install MariaDB:

sudo apt install mariadb-server mariadb-client -y

Start and enable MariaDB:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 5: Create a Database for Flarum

Access the MariaDB shell:

sudo mysql

Set up a new database and user:

CREATE DATABASE database_name;
CREATE USER 'database_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 6: Install Flarum

Clone the Flarum repository to the Apache root:

sudo git clone https://github.com/flarum/flarum.git /var/www/html/flarum

Adjust the directory ownership to Apache's user:

sudo chown -R www-data:www-data /var/www/html/flarum/

Step 7: Configure Apache for Flarum

Create a new virtual host file for Flarum:

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

Add the following configuration, replacing placeholders with actual details:

<VirtualHost *:80>
ServerName domain_name
DocumentRoot /var/www/html/flarum/public

<Directory /var/www/html/flarum/public>
AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the configuration and restart Apache:

sudo a2ensite flarum.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 8: Install Flarum Web Installer

Access the Flarum installer via your web browser at http://your_domain.com/install.php, and complete the setup.

Congratulations, you've successfully set up Flarum on Debian. Start building your forum community today!