How to Install Fuel CMS on Ubuntu 18.04 LTS
Fuel CMS is a free and open source content management system written in PHP that can be used to develop websites and blogs. It is based on CodeIgniter PHP web framework that can be used for advanced web development.
Fuel CMS comes with wide range of features some of them are listed below:
- Supports multiple language, so you can create SEO friendly page content in any language you want.
- Easily edit your page’s data on the actual page and see results immediately.
- Upload and manage your sites’ images, PDFs, style sheets and javascript.
- Easily create forms for layout variables and use them to build pages.
In this tutorial, we will learn how to install Fuel CMS on Ubuntu 18.04.
Prerequisites
- A server running Ubuntu 18.04.
- A non-root user with sudo privileges.
Install LAMP Server
Fuel CMS runs on web server, written in PHP and uses MariaDB for the database. So you will need to install Apache, MariaDB, and PHP to your system.
First, install Apache and MariaDB using the following command:
sudo apt-get install apache2 mariadb-server -y
Once Apache and MariaDB are installed, start Apache and MariaDB service and enable them to start on boot using the following command:
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql
By default, the latest version of PHP not available in Ubuntu 18.04. So you will need to add PHP repository to your system. You can install Ondrej PHP repository using the following command:
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
Once the repository is installed, update the repository and install PHP7.1 using the following command:
sudo apt-get update -y
sudo apt-get install php7.1 libapache2-mod-php7.1 php7.1-gd php7.1-xml php7.1-cli php7.1-zip php7.1-common php7.1-sqlite3 php7.1-mcrypt php7.1-curl php7.1-intl php7.1-mbstring php7.1-xmlrpc php7.1-mysql -y
Once PHP is installed, you will need to modify php.ini file. You can do this with the following command:
sudo nano /etc/php/7.1/apache2/php.ini
Make the following changes:
file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 256M upload_max_filesize = 120M max_execution_time = 300 date.timezone = Asia/Kolkata
Save and close the file, when you are finished.
Configure MariaDB
By default, MariaDB installation is not secured. So you will need to secure it first. You can secure it by running the following command:
sudo mysql_secure_installation
Answer all the questions as shwon below:
Enter current password for root (enter for none): Set root password? [Y/n]: N Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Once the MariaDB is secured, log in to MariaDB shell with the following command:
mysql -u root -p
Enter your root password when prompt, then create a database and user for Fuel CMS:
MariaDB [(none)]> CREATE DATABASE fuelcmsdb;
MariaDB [(none)]> CREATE USER 'fueluser'@'localhost' IDENTIFIED BY 'password';
Next, grant all privileges to Fuel CMS using the following command:
MariaDB [(none)]> GRANT ALL ON fuelcmsdb.* TO 'fueluser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Next, flush the privileges using the following command:
MariaDB [(none)]> FLUSH PRIVILEGES;
Finally, exit from the MariaDB shell with the following command:
MariaDB [(none)]> exit
Install Fuel CMS
First, you will need to download the latest version of the Fuel CMS. You can download it from the Git repository using the following command:
wget https://github.com/daylightstudio/FUEL-CMS/archive/master.zip
Next, unzip the downloaded file using the following command:
unzip master.zip
Next, copy the extracted file to the Apache web root directory:
sudo cp -r FUEL-CMS-master /var/www/html/fuelcms
Next, give proper permission to the fuelcms directory:
sudo chown -R www-data:www-data /var/www/html/fuelcms/
sudo chmod -R 755 /var/www/html/fuelcms/
Next, you will need to create an Apache virtual host file for Fuel CMS. You can do this with the following command:
sudo nano /etc/apache2/sites-available/fuelcms.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/fuelcms ServerName example.com <Directory /var/www/html/fuelcms/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/fuelcms_error.log CustomLog ${APACHE_LOG_DIR}/fuelcms_access.log combined </VirtualHost>
Save and close the file, then enable fuelcms virtual cms file and Apache mode rewrite module using the following command:
sudo a2ensite fuelcms
sudo a2enmod rewrite
Finally, restart Apache web server using the following command:
sudo systemctl restart apache2
Next, you will need to import the fuel_schema.sql into the newly created database:
sudo mysql -u fueluser -p fuelcmsdb < /var/www/html/fuelcms/fuel/install/fuel_schema.sql
Next, you will need to configure database settings in database.php file. You can do this using the following command:
sudo nano /var/www/html/fuelcms/fuel/application/config/database.php
Make the following changes:
$db['default'] = array( 'dsn' => '', 'hostname' => 'localhost', 'username' => 'fueluser', 'password' => 'password', 'database' => 'fuelcmsdb', 'dbdriver' => 'mysqli', 'dbprefix' => '',
Save and close the file, when you are finished.
Next, you will need to generate random key using Openssl:
openssl rand -base64 20
Output:
82SbyDJz4J9zsRk4E5l/FThYTK4=
Next, open config.php file and paste the above key:
sudo nano /var/www/html/fuelcms/fuel/application/config/config.php
Make the following changes:
$config['encryption_key'] = '82SbyDJz4J9zsRk4E5l/FThYTK4=';
Save the file, then open MY_fuel.php file to enable admin login:
sudo nano /var/www/html/fuelcms/fuel/application/config/MY_fuel.php
Make the following changes:
// whether the admin backend is enabled or not $config['admin_enabled'] = TRUE; $config['fuel_mode'] = 'AUTO';
Save and close the file, when you are finished.
Access Fuel CMS
Fuel CMS is now installed and configured, it's time to access Fuel CMS web interface.
Open your web browser and type the URL http://example.com/fuel, you will be redirected to the following page:
Now, provide admin username as admin and password as admin, then click on the Login button. You should see the following page: