Introduction
Fuel CMS is an open-source content management system written in PHP that can be used to develop websites and blogs. It is built upon the popular PHP web framework CodeIgniter and plays nicely with your existing installations.
This article will explain how to install and configure the Fuel CMS with the help of the LAMP stack on Ubuntu 20.04 OS.
Prerequisites
The following packages are required to install Fuel CMS on Ubuntu.
- LAMP Stack
- Database
- PHP
Installation of LAMP Stack
- Update the package index and upgrade the system.
$ sudo apt update && sudo apt -y upgrade
- Install Apache webserver.
$ sudo apt install -y apache2
- After successfully installing the Apache web server, verify the installation by opening the browser and entering the public IP address of your server or domain name.
Output
Install a Database Server
Fuel CMS requires a database to store the data. So we will be installing the MariaDB server.
- Installing the MariaDB server, run the below command.
$ sudo apt install -y mariadb-server mariadb-client
- For secure it. Run the below command and provide the root credentials when prompted.
$ sudo mysql_secure_installation
Output
- Once secure installation is complete, login to the RDMS as a root user.
$ sudo mysql -u root -p
- Once after logged in as root user, create a new database with the name
test_fuelcms
.
OutputCREATE database test_fuelcms;
- List the databases in the server by running the
SHOW DATABASES
command.
OutputSHOW DATABASES;
- Create a new
idrive_compute_test_user
and assign ALL privileges to it. Also, replacetest password
with an appropriate password of your choice.CREATE USER 'idrive_compute_test_user'@'localhost' IDENTIFIED BY 'test password';
GRANT ALL PRIVILEGES ON test_fuelcms.* TO 'idrive_compute_test_user'@'localhost';
FLUSH PRIVILEGES; EXIT;
Installing PHP
- Installing the PHP package.
$ sudo apt install -y php
- Install the below PHP extensions which are required.
$ sudo apt install -y php-{common,mysql,xml,xmlrpc,curl,gd,imagick,cli,dev,imap,mbstring,opcache,soap,zip,intl}
- Restart the Apache webserver for reloading PHP packages.
$ sudo systemctl restart apache2
- Verify the PHP is running by create a
info.php
file in the root directory.
$ sudo nano /var/www/html/info.php
Add the following code to the
info.php
file.
Save and close the file. Verify the PHP installation by opening the browser and entering the public IP address of your server or domain name, followed by<?php
phpinfo();/info.php
.
Examples:
a. <IPV4_address>/info.php
b. test.com/info.php - Connect PHP to the
test_fuelcms
database that was created earlier. Create a new test_fuelcms_database.php file.
Add the following code to the$ sudo nano /var/www/html/test_fuelcms_database.php
test_fuelcms_database.php
file.
Save and close the file. Enter your server's public IP address in the browser, followed by<?php
$conn = new mysqli('localhost', 'idrive_compute_test_user', 'test password', 'test_fuelcms');
if ($conn->connect_error) {
die("Database connection failed: " . $conn->connect_error);
}
echo "Database connection was successful";/test_fuelcms_database.php
to verify the database connection.
Example:
<IPV4_address>/test_fuelcms_database.phpOutput
"Database connection was successful";
Configure Apache and Install Dependencies
After completing the installation of the LAMP stack. Now it's time to configure the apache server and its dependencies to run the Fuel CMS.
- Restart the Apache webserver for enabling the rewrite module.
$ sudo systemctl restart apache2
- Enable the Apache
mod_rewrite
module.
$ sudo a2enmod rewrite
- Install the libapache2-mod-php dependency.
$ sudo apt install -y libapache2-mod-php
- For reloading the new configuration, you need to restart the apache.
$ sudo systemctl restart apache2
- Install unzip package for extracting the archives.
$ sudo apt install unzip
Install Fuel CMS
- Under your web server's root directory, create the fuel_cms directory.
$ sudo mkdir -p /var/www/fuel_cms
- Change the ownership of the directory.
$ sudo chown -R $USER:$USER /var/www/fuel_cms
- Navigate to the new directory.
$ cd /var/www/fuel_cms
- Install Fuel CMS from the GitHub repository by executing the below command.
$ sudo wget https://github.com/daylightstudio/FUEL-CMS/archive/master.zip
- Unzip the
master.zip
installation archive.
$ unzip master.zip
- Move the extracted file from the current location to
/var/www/fuel_cms/
.
$ mv /var/www/fuel_cms/FUEL-CMS-master/* /var/www/fuel_cms/
Configure Fuel CMS
- Edit the
database.php
configuration file.
$ sudo nano /var/www/fuel_cms/fuel/application/config/database.php
- Search the
$db['default']
section by using CTRL+W from the keyboard and edit the username, password, and database values as shown below.
(Note: Use the password which is created at the time of database creation).
Save and close the file. After adding the above values in respective fields.$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'idrive_compute_test_user',
'password' => 'test password',
'database' => 'test_fuelcms',
'dbdriver' => 'mysqli',
); - Initialize the
test_fuelcms
database.
Themysql -u idrive_compute_test_user -p test_fuelcms < /var/www/fuel_cms/fuel/install/fuel_schema.sql
idrive_compute_test_user
account password needs to be entered when prompted. - Generate an encryption key for Fuel CMS that is strong and random.
$ openssl rand -base64 20
Output
rrBD9mxcLTatOqdn8LA+zZRcvYY=
- Edit the Fuel CMS configuration file.
$ sudo nano /var/www/fuel_cms/fuel/application/config/config.php
- Search the
$config['encryption_key']
section by using CTRL+W from the keyboard and adding the random encryption which was generated at the earlier step.
Save and close the file.$config['encryption_key'] = 'rrBD9mxcLTatOqdn8LA+zZRcvYY=';
- Edit the
MY_fuel.php
file.
Search the$ sudo nano /var/www/fuel_cms/fuel/application/config/MY_fuel.php
$config['admin_enabled']
section by using CTRL+W from the keyboard and change the value fromFALSE
toTRUE
as shown below.$ config['admin_enabled'] = TRUE;
- Create a new .htaccess file in the
/var/www/fuel_cms/fuel/
directory.
Add the following settings to make URLs shorter.$ sudo nano /var/www/fuel_cms/fuel/.htaccess
Save and close the file.<IfModule
mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [L]
</IfModule> - Change the
www-data
ownership of the fuel_cms directory.
$ sudo chown -R www-data:www-data /var/www/fuel_cms
Creating a Virtual Host for Fuel CMS
- For reloading the new configuration, you need to restart the apache server.
$ sudo systemctl restart apache2
- Disable the default Apache virtual host.
$ sudo a2dissite 000-default.conf
-
Save and close the file.
- Create a new
fuel_cms.conf
Apache configuration file undersites-available
the directory.
Add the following code by replacing test.com with the public IP address of your server or domain name.$ sudo nano /etc/apache2/sites-available/fuel_cms.conf
Save and close the file.<VirtualHost *:80>
ServerName test.com
DocumentRoot "/var/www/fuel_cms"
<Directory "/var/www/fuel_cms">
Require all granted
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> - For reloading the new configuration, you need to restart the apache.
$ sudo systemctl restart apache2
- Enabling the new configuration file.
$ sudo a2ensite fuel_cms.conf
- Restart Apache to reload the new virtual host.
$ sudo systemctl restart apache2
Verify the installation
- Open the browser and enter the public IP address of your server or domain name.
- To access the administration page, append
/fuel
to the URL. - Enter the default username and password (i.e. admin) to view the Fuel CMS Dashboard page.
Now, You have successfully installed the Fuel CMS and all the operations can be performed as deemed.