Installing Joomla! on Ubuntu

Updated on September 2, 2015
Installing Joomla! on Ubuntu header image

Joomla! is a CMS that's relatively easy to use and is a very nice alternative to WordPress. As of 2015, about 2.8% of all sites on the internet use Joomla! as their CMS. In this guide we'll see how to install Joomla! on Ubuntu with a LAMP stack (using the Apache web server).

Step 1: Installing Apache

Update your repository list first:

apt-get update

Then, install the Apache web server:

apt-get install apache2

Step 2: Installing MySQL

We will install MySQL for databases and php5-mysql so that PHP can communicate with MySQL.

apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Give your MySQL root user a safe password.

Setup MySQL:

mysql_install_db

Finish the installation by executing:

/usr/bin/mysql_secure_installation

Enter your root password that you just created.

Use the following settings to be ensured that your MySQL installation is secured:

Change the 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

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Step 3: Installing PHP

PHP is required to use Joomla!. Install it with apt-get:

apt-get install php5 libapache2-mod-php5 php5-mcrypt

PHP is now installed.

Step 4: Confirming the installation of LAMP

Confirm that Apache was installed successfully by entering the IP of your server in your browser. You will see the "Apache2 Ubuntu Default Page" page.

In order to confirm that PHP was successfully installed, remove the default page:

rm /var/www/html/index.html

Create a new file:

touch /var/www/html/index.php

Edit it:

vi /var/www/html/index.php

And enter sample PHP code such as:

<?php
phpinfo();
?>

Enter your server IP in your browser again. You will now see a page with output like:

PHP Version 5.5.12-2ubuntu4.6

This is a page with information about your PHP installation. PHP is working if you see this page. Now remove your index.php file:

rm /var/www/html/index.php

Step 5: Installing Joomla! files

Joomla! requires a number of files to be downloaded that are needed to use the CMS. Go to the folder /var/www/html and download Joomla!:

cd /var/www/html
wget https://github.com/joomla/joomla-cms/releases/download/3.4.3/Joomla_3.4.3-Stable-Full_Package.zip

Install unzip if you don't have it installed yet:

apt-get install unzip

Unzip the Joomla! files:

unzip Joomla*

Make the .htaccess file active by renaming it:

mv htaccess.txt .htaccess

Step 6: Creating a Joomla! database

You will need to create a MySQL database where Joomla! can store its data. In order to do this, go to MySQL:

mysql -u root -p

In this command, -u is the name of the MySQL user and -p specifies that you need to be authenticated with a password.

Create a new user:

CREATE USER 'joomla'@'localhost' IDENTIFIED BY 'password';

This reads that joomla should be the username of your new MySQL user and password will be its password. For example, if you would like the name of the user to be cms and the password to be test123, type:

CREATE USER 'cms'@'localhost' IDENTIFIED BY 'test123';

Grant privileges so this user will be able to use your database:

GRANT ALL PRIVILEGES ON * . * TO 'cms'@'localhost';

Again, cms is the username of the MySQL user that you just created.

Make sure your changes are active right away, so type:

FLUSH PRIVILEGES;

Now create a database:

CREATE DATABASE joomla;

Replace joomla with the database name.

Type quit or exit to exit the shell.

Step 7: Installing Joomla!

Go to your server IP in your browser. You will now see the Joomla! installation process.

Enter your website name, and other miscellaneous info. Once entered, click "Next".

In the Database Configuration section, you'll need to enter the username, password, and database name you've just created. In my case, this would be:

Database Type: MySQLi
Host Name: localhost
Username: cms
Password: test123
Database Name: joomla
Table Prefix: this can be anything you like. For example: cms_ or joomla_
Old Database Process: Remove

Click "Next" after confirming the data you have entered is correct.

Congrats! You have now installed Joomla!.