CMS

How to Install Fuel CMS on CentOS 8

In this tutorial, we will see how it is easy to install Fuel CMS on CentOS 8.

FUEL CMS is a CodeIgniter based content management system. You can get the source code on Github.

Let’s start with the installation.

1. Keep the server up to date

# dnf update -y

2. Install EPEL repository

# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

3. Install required packages

# dnf install -y socat unzip wget

4. Install PHP

By default, CentOS 8 install PHP 7.2 and PHP 7.3. In order to install PHP 7.4 first, we need to install Remi repository,  which will provide the PHP 7.4 packages we want to install along with some handy package management utilities.

# dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm -y

Next, in order to enable the PHP remi-7.4 stream run the following dnf commands.

# dnf module reset php -y

# dnf module enable php:remi-7.4 -y

Now, install PHP

# dnf install php php-cli php-fpm php-mysqld php-common -y

Check the version.

# php -v

Start and enable PHP-FPM service.

# systemctl start php-fpm.service
# systemctl enable php-fpm.service

5. Install MariaDB

Create a MariaDB repository

Open the setting MariaDB repositories page, choose a distro, release and version of the MariaDB you wish to install.

In this article, we are using MariaDB 10.5

Create the MariaDB.repo file in you favourite editor:

# vi /etc/yum.repos.d/MariaDB.repo

And add following lines:

# MariaDB 10.5 CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/

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

Now, start the installation of the MariaDB 10.4

# dnf install MariaDB-client MariaDB-server -y

After it’s finished, start MariaDB:

# systemctl start mariadb.service

# systemctl enable mariadb.service

The installation is completed.

Secure the MySQL

To secure the MySQL installation, you should remove the anonymous user created during installation. To do so, run the following command:

# mysql_secure_installation

Log into MariaDB as the root user.

# mysql -u root -p

Create a new MariaDB database and database user, and remember the credentials.

CREATE DATABASE db_name;
GRANT ALL ON db_name.* TO ‘username’ IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
quit

Replace db_name and username with appropriate names for your setup. Replace password with a strong password.

6. Install Nginx

# dnf install nginx -y

Check the version.

# nginx -v

Start and enable Nginx.

# systemctl start nginx.service
# systemctl enable nginx.service

Configure Nginx for Fuel CMS. Run following command:

# vi /etc/nginx/conf.d/fuel.conf

Add following lines in the file

server {

listen 80;
root /usr/share/nginx/html/fuel;
index index.php index.html index.htm;
server_name example.com;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

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

}

Test Nginx configuration.

# nginx -t

Reload Nginx.

# systemctl reload nginx.service

7. Install Fuel CMS

Create the document root directory.

# mkdir -p /usr/share/nginx/html/fuel

Download the latest release of Fuel CMS.

# cd /usr/share/nginx/html/fuel
# wget https://github.com/daylightstudio/FUEL-CMS/archive/master.zip
# unzip master.zip
# rm master.zip
# mv FUEL-CMS-master/* .
# rm -rf FUEL-CMS-master

Configure the fuel/application/config/database.php file with the proper database connection settings.

# vi fuel/application/config/database.php

Import the fuel/install/fuel_schema.sql file into the newly created database.

# mysql -u username -p password < fuel/install/fuel_schema.sql

Replace username and password with your database credentials.

Change the $config[‘encryption_key’] on line 327 found in the fuel/application/config/config.php file. To generate a random key you can use the openssl tool.

# vi fuel/application/config/config.php

Enable the admin backend by changing $config[‘admin_enabled’] = FALSE; to TRUE.

# vi fuel/application/config/MY_fuel.php

Create the /var/lib/php/session directory and change its ownership to the user nginx.

# mkdir -p /var/lib/php/session && sudo chown -R nginx:nginx /var/lib/php/session

Change ownership of the /usr/share/nginx/html/fuel directory to nginx.

# chown -R nginx:nginx /usr/share/nginx/html/fuel

Run following command to set the user and group to nginx. Initially, they will both be set to apache.

# vi /etc/php-fpm.d/www.conf
user = nginx
group = nginx

Restart the PHP-FPM service.

# systemctl restart php-fpm.service

Open your browser and go to /fuel. Use the following login credentials Username: admin and Password: admin. After logging in, you need to change your admin password.

In this tutorial, we have seen how it is easy to install Fuel CMS on CentOS 8.

Related Articles