Install FLARUM CentOS 7 on AWS Linux.

Will Install FLARUM in CentOS 7 AWS Linux in this POST. The Flarum is a community discussion software, which is simple, fast, and free. Flarum is built with PHP so it’s quick and easy to deploy.

Flarum is carefully designed to be consistent and intuitive across platforms, out-of-the-box. Customise, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.

You can find the code of Flarum on GitHub. Also, they have an official website for Flarum.

Install FLARUM CentOS 7

STEP 1: We will disable the Firewall on the CentOS Linux.

$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld
$ sudo setenforce 0 

So, we have stopped the firewall on the CentOS 7 Server, the “setenforce 0” will stop the SELinux on a temporary basis. If you have to disable the SELinux, refer to the file “/etc/selinux/config”.

Go at the file“/etc/selinux/config” and change the parameter SELINUX=disabled, but these changes require a restart on the Linux server.

STEP 2: Setup MariaDB for Flarum.

So you can also Install MySQL 5.6+ for Flarum, but here we are installing MariaDB version 10.3+.

NOTE: The new version of Flarum does not support the MariaDB version less than 10.3.

$ sudo vim /etc/yum.repos.d/MariaDB.repo

The above command will create a file for a MariaDB repo and paste the below code.

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Then save and quit the file.

$ sudo yum install MariaDB-server MariaDB-client
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
$ sudo mysql_secure_installation

The above command will set the root password and will ask for some Privileges, whether to keep the old tables or not just type “Y” and it will set the root password. Find any difficulty with the above command follows the link.

Connect the MariaDB server and then create a database for the Flarum.

$  mysql -u root -p
$ CREATE DATABASE flarum;

STEP 3: Setup Nginx on CentOS 7 for Flarum.

If you want detail installation for Nginx, follow this link.

$ sudo yum install epel-release -y
$ sudo yum install nginx -y
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
$ sudo systemctl enable nginx

STEP 4: Setup PHP on CentOS 7 for Flarum.

Just make a note that the new version of Flarum supports the PHP version 7.3+, So let’s install the PHP now.

$ wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo rpm -Uvh remi-release-7.rpm
$ sudo yum install yum-utils -y
$ sudo yum-config-manager --enable remi-php73
$ sudo yum install php-fpm php-common php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
$ sudo vim /etc/php-fpm.d/www.conf

Edit the above file and make the changes according to the below configuration given.

    user = apache to user = nginx
    group = apache to group = nginx
    listen.owner = nobody to listen.owner = nginx //Uncomment this line by removing ;
    listen.group = nobody to listen.group = nginx  //Uncomment this line by removing ;

After the changes save and quit the file and start the services and enable the services for php-fpm.

$ sudo systemctl start php-fpm.service
$ sudo systemctl enable php-fpm.service

STEP 5: Install Composer using PHP on CentOS 7 for Flarum.

$ sudo curl -sS https://getcomposer.org/installer | php
Install Flarum Centos 7

The above command will download the installer for the composer, we have to move the file “composer.phar” into “/usr/local/bin/composer”

$ sudo mv composer.phar /usr/local/bin/composer

Then go to the nginx hosting directory and set up the flarum in centos 7.

$ cd /usr/share/nginx/html/

If this folder contains some files and folders, then you have to delete the files and folders. Just be careful while removing anything from the html directory or “you can create one directory for flarum”

$ rm -rf * 
$ composer create-project flarum/flarum . --stability=beta
Install Flarum Centos 7

Now let’s configure the Nginx, So first we will edit the “nginx.conf” which is in “/etc/nginx“.

Comment the following line as given on the screenshot below.

Install Flarum Centos 7

After the configuration we will make the file “flarum.conf” in “/etc/nginx/conf.d” and paste the below code into the flarum.conf

server {
    listen   80;
    server_name  flarum.tastethelinux.com 192.168.0.103;
 
root   /usr/share/nginx/html/public;
index index.php index.html index.htm;

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

location /flarum {
    deny all;
    return 404;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

location ~* \.html$ {
    expires -1;
}

location ~* \.(css|js|gif|jpe?g|png)$ {
    expires 1M;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types application/atom+xml
           application/javascript
           application/json
           application/vnd.ms-fontobject
           application/x-font-ttf
           application/x-web-app-manifest+json
           application/xhtml+xml
           application/xml
           font/opentype
           image/svg+xml
           image/x-icon
           text/css
           text/plain
           text/xml;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
   }

Save and quit the file and use the command “sudo nginx -t” and restart the service of Nginx

$ sudo nginx -t
$ sudo systemctl restart nginx
$ sudo chown -R nginx: /usr/share/nginx/html/ 
$ sudo chown -R nginx: /var/lib/php

After that just open the browser and put the URL of the flarum, If you are using a domain kindly configure the SSL, I have configured the flarum with IP as well as domain and configure it into the /etc/hosts file.

Install Flarum Centos 7
Installation Page
Login Screen
Admin Page

Have a good day! Thanks for reading the POST. Kindly Share the POST and Keep Supporting US!

ERROR: IF YOU WILL GET THE ERROR “Directory not Writable, After changing the permission, Then disable the firewalls of the CentOS Server”

“Directory not Writable”
$ sudo setenforce 0 

So, we have stopped the firewall on the CentOS 7 Server, the “setenforce 0” will stop the SELinux on a temporary basis. If you have to disable the SELinux, refer to the file “/etc/selinux/config”.

Go to the file “/etc/selinux/config” and change the parameter SELINUX=disabled, but these changes require a restart of the Linux server.

Use the above command and refresh the page on the browser.

One Reply to “Install FLARUM CentOS 7 on AWS Linux.”

Give your valuable time