Set Up Flarum From Scratch

There are words that may take minute(s)

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
# sudo vim /etc/httpd/conf/httpd.conf

Add this to the end of the file:

IncludeOptional sites-enabled/*.conf

Enable rewrite function

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

Find this:

#
# Relax access to content within /var/www.
#
<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

Change AllowOverride None to AllowOverride ALL.

Install MySQL

See this

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

# sudo yum install mariadb-server
# sudo systemctl status mariadb
# sudo systemctl enable mariadb
# sudo mysql_secure_installation

Then create a user and a dataabase 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:

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# 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
# mv composer.phar /usr/local/bin/composer

Fetch flarum content

Currently its version is v0.1.0-beta.7.

# cd flarum
# composer create-project flarum/flarum . --stability=beta

Adjust ownership and permissions

As for now flarum itself has some issues with its file permissions like extensions, so I'm just gonna do it the hard way.

# cd /var/www
# sudo chown -R apache:apache flarum
# sudo chmod -R 777 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:

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

Make your config go live

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

Restart Apache server

# 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 😃