Hello, friends. Developing a forum for our site can be a very useful idea. That’s why, in this post, we’ll help you to install Flarum Forum on Ubuntu 20.04
Flarum Forum
Flarum is a delightfully simple discussion platform for your website. It’s fast and easy to use, with all the features you need to run a successful community.
Flarum is the combined successor of esoTalk (opens new window)and FluxBB (opens new window). It is designed to be:
- Fast and simple. No clutter, no bloat, no complex dependencies. Flarum is built with PHP so it’s quick and easy to deploy. The interface is powered by Mithril (opens new window), a performant JavaScript framework with a tiny footprint.
- Beautiful and responsive. This is forum software for humans. Flarum is carefully designed to be consistent and intuitive across platforms, out-of-the-box.
- Powerful and extensible. Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.
- Free and open. Flarum is released under the MIT license (opens new window).
All this information is taken from the official Flarum documentation.
So let’s install it and have a look at it.
Install Flarum Forum on Ubuntu 20.04
Note: Flarum Forum is still in beta. This indicates that it is not ready for production even though it is quite usable. So use it for testing or to collaborate with development.
Getting LAMP on Ubuntu 20.04
Before starting with the installation, it is advisable to make some minor adjustments and installations on the system.
First, update the distribution completely from the terminal:
sudo apt update sudo apt upgrade
After that, it is necessary to install LAMP on Ubuntu 20.04 because Flarum Forum requires a web environment.
To install Flarum Forum you also need to install these necessary PHP modules and packages.
php libapache2-mod-php php-cli php-fpm php-common php-common php-mbstring php-gd php-xml php-mysql php-curl zip unzip curl wget git
Now we can continue.
Creating the database for Flarum Forum
Now it is necessary to create a new database and a user so that Flarum Forum can handle the data that is created.
sudo mysql -u root -p
And now create the database and the new user:
CREATE DATABASE flarum; GRANT ALL ON flarum.* TO 'flarumuser' IDENTIFIED BY 'flarumpss'; FLUSH PRIVILEGES; exit;
Installing Composer
Now it’s time to install Composer which is necessary to perform the installation. To install Composer run each of these commands:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php php -r "unlink('composer-setup.php');" sudo mv composer.phar /usr/local/bin/composer
And test it by running:
composer -V
We can continue.
Download Flarum Forum
Before downloading the application, let’s create a folder where we will do the download and make the current user the owner. This is to avoid using Composer as the root user.
sudo mkdir -p /var/www/flarum sudo chown -R $USER:$USER /var/www/flarum
Access the folder you created and install Flarum Forum by running
cd /var/www/flarum composer create-project flarum/flarum . --stability=beta
Then, make Apache the owner of the folder:
sudo chown -R www-data:www-data /var/www/flarum
The next step is to create a new VirtualHost to manage our site:
sudo nano /etc/apache2/sites-available/flarum.conf
And add the following content:
<VirtualHost *:80> ServerAdmin admin@your_domain.com DocumentRoot /var/www/flarum/public ServerName your-server
<Directory /var/www/flarum/public>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined </VirtualHost>
Replace ServerName
with your domain name. Save the changes and close the editor.
Now, enable the new VirtualHost, the Apache rewrite module, and apply the changes by restarting the service.
sudo a2ensite flarum sudo a2enmod rewrite sudo systemctl restart apache2
Install Flarum Forum on Ubuntu 20.04
So, now you can open a web browser and access Flarum Forum to complete the installation. In short, you can access it via http://your-domain
In this screen, you will have to complete the installation and define a name for the Forum as well as the database parameters.
Below you will be able to create the administrator account needed for access.
Then, you will then be able to see the dashboard.
Conclusion
In summary, Flarum is a project that looks great and that we can already enjoy in beta status. Setting it up is quite easy and that’s what you have learned in this post.