Befor you continue

1. Get a VPS from Linode/Vultr/whatever

2. Pick a linux distribution and make it running(I use CentOS 7).

3. Install Apache/MySQL/PHP 7.1

Get yourself a non-root sudo user

adduser USERNAME
passwd USERNAME
usermod -aG wheel USERNAME
su USERNAME

Install and configure Apache

Check this out

First install it.

sudo yum update
sudo yum -y install httpd
sudo systemctl enable httpd.service

Then create directory structure.

sudo mkdir /etc/httpd/sites-available
sudo mkdir /etc/httpd/sites-enabled

Open config file:

sudo vim /etc/httpd/conf/httpd.conf

Add this to the end of the file:

IncludeOptional sites-enabled/*.conf

Install MySQL

CentOS 7 by default uses MariaDB rather than MySQL, but there’s no difference using it.

Note: yum installs MariaDB 5.5 by default, which no longer satisfies flarum’s requirements. See here for instructions on installing MariaDB 10.

sudo mysql_secure_installation

Then create a user and a database in MySQL for flarum.

Install and configure PHP

I’m using php 7.1 here.

Take a look at this

First add needed yum repo:

sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Install php

sudo yum install mod_php71w php71w-cli php71w-xml php71w-mbstring php71w-mysql php71w-gd

4. Install Flarum

Create site directory

Name your site directory whatever you like, I’ll just stick with flarum.

sudo mkdir /var/www/flarum

Install composer

cd /tmp
sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Fetch flarum content

cd /var/www
sudo yum install unzip
sudo chown USERNAME:GROUPNAME flarum
cd flarum
composer create-project flarum/flarum . --stability=beta

Adjust ownership and permissions

Change directory’s ower to apache for apache to operate:

cd ..
sudo chown -R apache:apache flarum

5. Make it up and running

Create virtual host in apache for flarum

Name configuration file whatever you like:

cd /etc/httpd/sites-available
sudo vim flarum.conf

Fill in content below(Don’t forget the url rewrite block!):

<VirtualHost *:80>
    ServerName YOURDOMAIN
    ServerAlias ALIAS
    DocumentRoot /var/www/flarum/public
    ErrorLog /var/www/flarum/storage/logs/error.log
    CustomLog /var/www/flarum/storage/logs/requests.log combined

    <Directory "/var/www/flarum/public">
        DirectoryIndex index.php
        AllowOverride All
        allow from all
    </Directory>
</VirtualHost>

Make your config go live

sudo ln -s /etc/httpd/sites-available/flarum.conf /etc/httpd/sites-enabled/flarum.conf

Configure firewalld and restart Apache server

sudo firewall-cmd --add-service=http --permanent && sudo firewall-cmd --add-service=https --permanent
sudo systemctl restart firewalld
sudo apachectl restart

6. Visit your flarum site and enjoy!

Note:Wrote this down based on my memory, if there are any missing pieces, post a comment below 😃