Share this post
FaceBook  Twitter  

1. Introduction

MariaDB is an alternative choice for a database when professionals are looking for a robust, scalable, and reliable SQL server.  It is an opensource drop-in replacement for the MySQL database and behaves in the exactly same way as MySQL. In this article we will install Joomla CMS with combination of the MariaDB database and the Apache2 webserver.

2. Versions Used

Operating system and Software version used in this guide:

  • Ubuntu 12.04.2 LTS
  • Joomla 3.0
  • Distrib 5.5.29-MariaDB
  • PHP 5.3.10-1ubuntu3.5
  • Apache/2.2.22 (Ubuntu)

3. MariaDB Installation

Let's start with installation of the MariaDB database.

Following these steps from the official MariaDB website we will, first, need to setup repositories:

sudo apt-get install python-software-properties 
sudo apt-key adv --recv-keys --keyserver 0xcbcb082a1bb943db 
sudo add-apt-repository 'deb precise main'

Once the key is imported and the repository added you can install MariaDB with:

sudo apt-get update 
sudo apt-get install mariadb-server

During the installation you will be asked to provide a new password for the MariaDB administrator. You will use this password to create a new database later in this section. Check your port to confirm that MariaDB is running by:

$ netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0*               LISTEN

You can notice that MariadDB is running on the same port as MySQL.

3.1. Creating Database

In this step we will create a MySQL database to be used with Joomla CMS. For this we will create the following:

  • MariaDB database name: joomla
  • MariaDB user: joomla-user
  • MariaDB user password: joomla-pass

In this step you will need a root password to the MariaDB database. User name, database name and password are listed here as examples. Feel free to choose your own:

sudo mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 5.5.29-MariaDB-mariadb1~precise-log binary distribution

Copyright (c) 2000, 2012, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>  create database joomla;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> CREATE USER 'joomla-user'@'localhost' IDENTIFIED BY 'joomla-pass';
Query OK, 0 rows affected (0.00 sec)

    -> on joomla.* to 'joomla-user'@localhost;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> quit

The above will create a new database and user to be used later during the Joomla installation.

4. Apache and PHP

At this stage we will install the PHP support and the Apache webserver. When it comes to MariaDB PHP adapter we will use php5-mysql.

$ sudo apt-get install php5-mysql libapache2-mod-php5

The above will fetch all required prerequisites. In the next step we need to configure a new apache site to point to the /var/www/joomla directory. This can be easily done be making a modified copy of a default site:

$ cd /etc/apache2/sites-available
$ sudo sh -c 'sed "s/www/www\/joomla/g" default > joomla'

Restart apache2 webserver by:

$ sudo a2dissite default
$ sudo a2ensite joomla
$ sudo service apache2 reload

Download and unzip Joomla CMS Next, download and unzip Joomla CMS source files into the /var/www/joomla directory. Feel free to change the directory name to suit your environment. The command below will download Joomla source files. Unzip them in /var/www/joomla and change the owner of the entire directory to apache2 user www-data.

$ sudo mkdir /var/www/joomla
$ cd /var/www/joomla
$ sudo wget

All what remains is to unzip and change the owner:

$ sudo unzip
$ sudo chown -R www-data.www-data /var/www/joomla

5. Joomla Installation

Everything should be now ready for the actual Joomla with MariaDB installation. At this point you either need to change your DNS settings to point to this new installation or simply alter the /etc/hosts file on your local box with an appropriate server IP address where the Joomla script is hosted. For example:       joomla.local

When done, navigate to the http://joomla.local URL using your browser and conclude the installation of Joomla with a few self-explanatory steps.

6. Conclusion

For all intentions and purposes, MariaDB is a binary drop in replacement of the same MySQL version. For example, MySQL 5.5 -> MariaDB 5.5, etc. are compatible. Data and table definitions are also binary compatible as well as all MySQL connectors like PHP, Perl, Python, Java etc.


Who are we? is not affiliated with any local or international company, nor is it a recruitment or employment agency. We specialise in Linux based careers and closely related Information Technology fields by providing careers advice and latest employment opportunities.


You can also get involved in the LinuxCareer project by participating on our FORUM or SUBMITTING A LINUX ARTICLE. We offer a range of privileges to our authors and good company.