There is a new version of this tutorial available for Ubuntu 20.04 (Focal Fossa).

How to Install Flarum Community Software on Ubuntu 18.04

This tutorial exists for these OS versions

On this page

  1. Requirements
  2. Install LAMP Server
  3. Configure Database
  4. Install Flarum
  5. Access Flarum

Flarum is a free and open source software written in PHP and Mithril.js. It is simple, fast, beautiful and responsive software that is specially designed to be consistent and intuitive across platforms, out-of-the-box. You can easily setup communities in minutes to stay in touch with group of people using Flarum.

In this tutorial, we will explain how to install Flarum in Ubuntu 18.04 server.


  • A server running Ubuntu 18.04.
  • A not-root user with sudo privileges is setup to your server.

Install LAMP Server

Flarum runs on web server, written in PHP and uses MariaDB as a database. So you will need to install Apache, MariaDB and PHP to your system. First, install Apache and MariaDB using the following command:

sudo apt-get install apache2 mariadb-server -y

Next, install PHP7.1 to your system. But, PHP7.1 is not available in Ubuntu 18.04 default repository. So you will need to add the repository for PHP first. You can add it with the following command:

sudo apt-get install python-software-properties -y
sudo add-apt-repository -y ppa:ondrej/php

After installing PHP repository, install PHP7.1 along with all the required libraries using the following command:

sudo apt-get install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-mysql php7.1-gd php7.1-xml php7.1-cli php7.1-zip wget unzip curl git -y

Next, you will also need to make some changes in php.ini file:

sudo nano /etc/php/7.1/apache2/php.ini

Make the following changes:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_file_size = 150M
max_execution_time = 450
date.timezone = Asia/Kolkata

Save and close the file, when you are finished. Then, start Apache and MariaDB service and enable them to start on boot with the following command:

sudo systemctl start apache2
sudo systemctl start mysql
sudo systemctl enable apache2
sudo systemctl enable mysql

Configure Database

By default, the MariaDB is not secured. So you will need to secure it first. You can secure it by running the mysql_secure_installation script:


Answer all the questions as shown below:

Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y

Next, log into MariaDB shell with the following command:

mysql -u root -p

Enter your root password, then create a Flarum database:

MariaDB [(none)]> CREATE DATABASE flarumdb;

Next, create a Flarum user with the following command:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON flarumdb.* TO 'flarum'@'localhost' IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB shell with the following command:

MariaDB [(none)]> EXIT;

Install Flarum

Next, you will need to install Composer to your system. The Composer is a dependency manager that can be used to install PHP dependencies. You can install Composer with the following command:

sudo curl -s | php
sudo mv composer.phar /usr/local/bin/composer

Next, create a directory under Apache web root for Flarum project:

sudo mkdir /var/www/html/flarum
cd /var/www/html/flarum

Next, run the following command to create a Flarum project:

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

Next, give proper permission to the Flarum directory:

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

Next, create an apache virtual host directive for Flarum:

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

Add the following lines:

<VirtualHost *:80>
 ServerAdmin [email protected]
 DocumentRoot /var/www/html/flarum
 <Directory /var/www/html/flarum/>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
 ErrorLog /var/log/apache2/flarum-error_log
 CustomLog /var/log/apache2/flarum-access_log common

Save and close the file, then enable virtual host file and rewrite module with the following command:

sudo a2ensite flarum
sudo a2enmod rewrite

Finally, restart Apache web server to apply all the changes:

Access Flarum

Open your web browser and nevigate to URL, you will be redirected to the following page:

Flarum Community manager installation

Flarum install

Here, provide your database details and admin credentials, then click on the Install Flarum button, once the installation is completed, you should see the Flarum welcome page in the following image:

Flarum dashboard

Share this page:

4 Comment(s)

Add comment

Please register in our forum first to comment.


By: corto

nice tutorial, is it possible to install it over ispconfig?


By: till

Sure, but that's way easier than doing it from groud up as described in the guide above. On a ISPConfig server, the steps are:


1) Create a website in ISPConfig with PHP enabled.

2) Create a database user and database in ISPConfig.

3) Run the composer command to install Flarum in the website 'web' directory of the site that you created in ISPConfig:


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

By: corto

 thank's, i will try it .

By: sunny

I followed your instructions to a tea and still can't get it to work: "Your requirements could not be resolved to an installable set of packages." Are you available for hire? I just need this installed on my server.