How to Install Joomla CMS on CentOS 7

Table of Contents

Introduction

Joomla is a free, open-source, and popular content management system (CMS) that can be used to build online applications and websites. It uses a PHP application and back-end database such as MySQL or MariaDB. A main benefit of using Joomla CMS is that it does not require significant technical skill or knowledge to manage. Joomla offers a wide range of features and has becomes a very popular CMS.

Some notable Joomla features are listed below:

  • Supports multiple operating systems such as Linux, FreeBSD, MacOSX server, Solaris, AIX and more.
  • Easily customize using a wide range of available extensions.
  • Easily integrates with LDAP, OpenID, and Gmail.
  • You can easily track who made what changes on your site.
  • You can create your own content easily using built in editor without any knowledge of code.
  • You can quickly find any information of your site using search and smart search features.

In this tutorial we will learn how to install Joomla CMS on a CentOS 7 server.

Requirements

  • A server running CentOS 7.
  • A non-root user with sudo privileges setup on your server.

Installing LAMP Stack

Update your system with the latest available packages.

You can update your CentOS 7 system with the following command:

sudo yum update -y

Once your system is updated, install the Apache web server with the following command:

sudo yum install httpd -y

Next you will need to install latest version of MariaDB. MariaDB is not available in the CentOS default repositories. So you will need to create a repo for MariaDB.

sudo nano /etc/yum.repos.d/mariadb.repo

Add the following lines:

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

Save the file and update your repository with the following command:

sudo yum update -y

Once your repository is updated, install MariaDB server with the following command:

sudo yum install mariadb-server

Start the Apache and MariaDB services and enable them to start at boot time:

sudo systemctl start httpd
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl enable mariadb

It is time to install PHP 7 and other required modules.

Install and update the repository for PHP 7 with the following command:

sudo yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-14.ius.centos7.noarch.rpm
sudo yum -y update

Install PHP 7 with the following command:

sudo yum -y install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-mcrypt php70u-gd php70u-devel php70u-intl php70u-mbstring php70u-bcmath php70u-json php70u-iconv

Once installation is finished, you can proceed to the next step.

Configure MariaDB Database

The default MariaDB installation is not secure. So you will need to secure it first. You can do this by running the following script:

sudo mysql_secure_installation

Answer all the questions as shown below. Be sure to set a strong password!

Enter current password for root (enter for none): Enter root password
Change the root password? [Y/n] Y
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 MariaDB is secured, create a database and user for Joomla.

First, log into the database with the following command:

mysql -u root -p

Enter the root password when asked, then create a database named joomladb and user for Joomla:

MariaDB [(none)]>create database joomladb;
MariaDB [(none)]>create user joomlauser@localhost identified by 'password';
MariaDB [(none)]>grant all privileges on joomladb.* to joomlauser@localhost;
MariaDB [(none)]>flush privileges;
MariaDB [(none)]>exit

Download and Configure Joomla

You can download the latest version of Joomla from the official website. Otherwise, you can download it from the GitHub with the following command:

wget https://github.com/joomla/joomla-cms/releases/download/3.6.5/Joomla_3.6.5-Stable-Full_Package.tar.gz

Once download is completed, extract the downloaded file inside the Apache web root directory:

sudo tar -xvzf Joomla_3.6.5-Stable-Full_Package.tar.gz -C /var/www/html/

Give proper permissions to the web root directory with the following command:

sudo chown -R apache:apache /var/www/html/
sudo chmod -R 775 /var/www/html/

Next you will need to configure Apache for Joomla.

You can do this by editing /etc/httpd/conf/httpd.conf file

sudo nano /etc/httpd/conf/httpd.conf

Change the line from AllowOverride None to AllowOverride All:

AllowOverride All

Save the file and restart the Apache service:

sudo systemctl restart httpd

Configure Firewall

You will need to allow port 80 and 443 to access the Joomla from outside network. You can do this by running the following commands:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

Reload the firewall service for the changes take effect.

sudo firewall-cmd --reload

Accessing Joomla

Once everything is set up, it is time to access the Joomla web installation wizard.

Open your web browser and type the URL http://your-server-ip, you should see the following page:

Joomla Installation Page

Provide all necessary information and click on the Next button, you should see the following page:

Joomla Database Info

Provide your database information and click on the Next button, you should see the following page:

Joomla FTP Info

Provide your FTP username and password as you wish and click on the Next button, you should see the following page:

Joomla Install Final

Make sure all the information is correct, then click on Install button.

Once installation is completed, you will get a notice to copy the auto-generated content and save it as configuration.php in the web root directory.

Copy this content and paste in configuration.php file in web root directory:

sudo nano /var/www/html/configuration.php

The code you are copying will be similar to the following code:

<?php
class JConfig {
public $offline_message = 'This site is down for maintenance.<br />Please check back again soon.';
public $display_offline_message = '1';
public $offline_image = '';
public $editor = 'tinymce';
public $captcha = '0';
public $list_limit = '20';
public $access = '1';
public $debug = '0';
public $debug_lang = '0';
public $dbtype = 'pdomysql';
public $host = 'localhost';
public $user = 'joomlauser';
public $password = 'something-secure';
public $db = 'joomladb';
public $dbprefix = 'gdh9j_';
public $live_site = '';
public $secret = 'UIss8P91O6b6mOiH';
public $gzip = '0';
public $error_reporting = 'default';
public $helpurl = 'https://help.joomla.org/proxy/index.php?keyref=Help{major}{minor}:{keyref}';
public $ftp_host = '127.0.0.1';
public $ftp_port = '21';
public $ftp_user = 'ftpuser';
public $ftp_pass = 'something-secure';
public $ftp_root = '';
public $ftp_enable = '1';
public $offset = 'UTC';
public $mailonline = '1';
public $mailer = 'mail';
public $sendmail = '/usr/sbin/sendmail';
public $smtpauth = '0';
public $smtpuser = '';
public $smtppass = '';
public $smtphost = 'localhost';
public $smtpsecure = 'none';
public $smtpport = '25';
public $caching = '0';
public $cache_handler = 'file';
public $cachetime = '15';
public $cache_platformprefix = '0';
public $MetaKeys = '';
public $MetaTitle = '1';
public $MetaAuthor = '1';
public $MetaVersion = '0';
public $robots = '';
public $sef = '1';
public $sef_rewrite = '0';
public $sef_suffix = '0';
public $unicodeslugs = '0';
public $feed_limit = '10';
public $feed_email = 'none';
public $log_path = '/var/www/html/administrator/logs';
public $tmp_path = '/var/www/html/tmp';
public $lifetime = '15';
public $session_handler = 'database';
}

Save and close the file. You will also be prompted to remove the installation folder.

sudo rm -rf /var/www/html/installation

Access the Joomla admin page by typing the URL http://your-server-ip/administrator on your web browser. You should see the Joomla admin login page as below:

Joomla Admin Login

Enter your admin username and a password then click on Login button. You should see the Joomla control panel:

Joomla Control Panel

Summary

Congratulations! You have successfully installed Joomla on your CentOS 7 server. You can now easily explore building and managing a website using this popular CMS. Feel free to comment below if you have any questions.