How to Install Flarum on Debian Latest

In this tutorial, we will show you how to install Flarum on Debian Latest. Flarum is an open-source forum software that is fast, responsive, and easy to use.

Prerequisites

Before starting with the installation process, you need to make sure that your system meets the following prerequisites:

Step 1: Install Required Packages

The first step is to update the package index on your Debian system and install the required packages. Open the terminal of the Debian system and run the following command:

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

Step 2: Install Apache Web Server

Next, install the Apache web server on your Debian system. Run the following command to install Apache:

sudo apt install apache2 -y

Once the installation is completed, start and enable the Apache service by running the following commands:

sudo systemctl start apache2
sudo systemctl enable apache2

Step 3: Install PHP and Required Extensions

Now, you need to install PHP and required extensions on your Debian system. Flarum requires PHP version 7.3 or later. Run the following command to install PHP and required extensions:

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

To check the installed PHP version, run the following command:

php -v

Step 4: Install MariaDB

Flarum requires a database to store its data. In this tutorial, we will use the MariaDB database. Run the following command to install MariaDB on your Debian system:

sudo apt install mariadb-server mariadb-client -y

Once the installation is completed, start and enable the MariaDB service by running the following commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 5: Create a Database for Flarum

Log in to the MariaDB shell using the following command:

sudo mysql

Create a new database and user with the following commands. Replace the database_name, database_user, and password with your own values.

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 software from the GitHub repository to the Apache root directory (/var/www/html/) using the following command:

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

Now, change the ownership of the Flarum directory to the Apache user (www-data) using the following command:

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

Step 7: Configure Apache for Flarum

Create a new Apache virtual host configuration file for Flarum using the following command:

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

And add the following content to the file. Replace the domain_name with your own domain name and replace the /var/www/html/flarum/public directory with the path to your Flarum installation directory.

<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>

Save and close the file.

Enable the Flarum virtual host and Apache rewrite module by running the following commands:

sudo a2ensite flarum.conf
sudo a2enmod rewrite

Restart the Apache service using the following command:

sudo systemctl restart apache2

Step 8: Install Flarum Web Installer

Open your web browser and navigate to http://your_domain.com/install.php to start the Flarum web installer. Follow the installation wizard and provide the database details that you have created in Step 5.

That's it. You have successfully installed Flarum on your Debian system. Now, you can start using Flarum to create your own forum website.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!