Setup Flarum on Digital Ocean

I'm always trying out new community platforms, so I figured I'd try out Flarum, which is from the developer of esoTalk. It is a very clean and clutter free forums, but very much in an alpha state. If you are interested in trying it out, here is a guide how to install it on Digital Ocean.

Create Droplet

Select LEMP on 14.04 with at least 1 GB of RAM as the Composer install script won't run on 512 MB. Once created login to your new droplet by running ssh root@ip address in terminal.

Create Database

Now that you are connected via terminal, you have to create a database for Flarum. Since we created a LAMP mySQL is already installed.

Run cat /etc/motd.tail to get your mySQL root password which was created with the LAMP image.

Now we can log to mySQL and create the DB.

  1. mysql -uroot -p
  2. mysql> CREATE DATABASE flarum;
  3. mysql> GRANT ALL PRIVILEGES ON flarum.* TO 'flarum'@'localhost' IDENTIFIED BY 'strongpassword';
  5. \\q

Note: Make sure you replace strongpassword with a password of your own. PasswordGenerator is an fast and strong password generator.

Installing Flarum

Now that we have a database, we can install Flarum.

First we have to install Composer which will install all the required libraries and dependencies for Flarum.

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

Create a folder for Flarum to live
sudo mkdir -p /usr/share/nginx/html/flarum

Run Flarum Composer Script
cd /usr/share/nginx/html/flarum composer create-project flarum/flarum . --stability=beta

Flarum is now installed, but we have to setup URL rewriting for it to work correctly.

sudo nano /etc/nginx/sites-available/default

Add the following in location /

try_files $uri $uri/ /index.php?$query_string;

Now copy this after the } in location /

      try_files $uri $uri/ /flarum/index.php?$args;
 location /flarum/ { try_files $uri $uri/ /flarum/index.php?$query_string; }
 location /flarum/api { try_files $uri $uri/ /flarum/api.php?$query_string; }
 location /flarum/admin { try_files $uri $uri/ /flarum/admin.php?$query_string; }

Reload nginx

service nginx restart

Flarum is now ready to setup in the web interface, just go to http://ip address/flarum. It will ask you to fill in the database information from above and create an admin user. Once that is complete you are done and ready to start trying Flarum.

Hopefully this makes it as easy as possible to setup and give Flarum a try. It is a very neat piece of software and hopefully the team will continue making improvements and feature updates.