How to Install Flarum Community Software on Debian 12

Flarum is a modern and lightweight forum software that promises to revolutionize online discussions. If you’re looking to set up Flarum on your Debian 12 system, you’re in the right place. This step-by-step guide will walk you through the installation process, ensuring that you have your forum up and running in no time.

Before we begin, be sure that you have a Debian 12 system with root access. You’ll also need to have Apache, PHP, MySQL, and Composer installed on your system. If you haven’t done so already, here are the commands to install those dependencies:

  1. Install Apache:

    sudo apt update
    sudo apt install apache2
  2. Install PHP and PHP extensions:

    sudo apt install php libapache2-mod-php php-mysql php-dom php-json php-mbstring php-gd php-curl php-zip
  3. Install MySQL server:

    sudo apt install mysql-server
  4. Install Composer:
    curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Now that you have all the necessary dependencies installed, let’s move on to installing Flarum:

  1. Download Flarum:

    composer create-project flarum/flarum . --stability=beta
  2. Set the correct permissions:

    sudo chown -R www-data:www-data /var/www/html/
  3. Generate the Flarum app key:

    php flarum key:generate
  4. Configure your Apache virtual host file:

    sudo nano /etc/apache2/sites-available/000-default.conf

    Add the following lines to the file:

    <VirtualHost *:80>
    ServerName your-domain.com
    DocumentRoot /var/www/html/public
    <Directory /var/www/html>
        AllowOverride All
    </Directory>
    </VirtualHost>
  5. Enable the Apache rewrite module:

    sudo a2enmod rewrite
  6. Restart Apache:

    sudo systemctl restart apache2
  7. Set up the Flarum database:

    sudo mysql
    mysql> CREATE DATABASE flarum;
    mysql> CREATE USER 'flarumuser'@'localhost' IDENTIFIED BY 'your_password';
    mysql> GRANT ALL PRIVILEGES ON flarum.* TO 'flarumuser'@'localhost';
    mysql> FLUSH PRIVILEGES;
    mysql> EXIT;
  8. Install Flarum:

    php flarum install
  9. Complete the installation wizard by entering your database details and setting up the forum admin account.

Congratulations! You now have Flarum up and running on your Debian 12 system. You can access your forum by visiting your domain in a web browser and start customizing it to your liking.

In conclusion, installing Flarum on Debian 12 is a straightforward process that can be completed in just a few steps. By following this guide, you’ll have a fully functional forum software up and running in no time. Enjoy engaging discussions and building a thriving online community with Flarum!