Installing Joomla! on Ubuntu 16.04

Published on: Mon, Nov 13, 2017 at 4:39 pm EST
Linux Guides Server Apps System Admin Ubuntu Web Servers

Joomla! is a popular content management system (CMS) written in PHP. It is the second most popular CMS behind Wordpress. As of 2017, about 3.3% of all sites on the internet use Joomla! as their CMS. This guide shows how to install Joomla! on Ubuntu 16.04 on a LAMP stack.

Step 1: Installing Apache

Update your repository list.

apt-get update

Install the Apache web server.

apt-get install apache2

Step 2: Installing MySQL

Joomla! runs on top of a LAMP stack. We will need to install MySQL and link it to PHP.

apt-get install mysql-server php7.0-mysql

You will be prompted for a MySQL password. Enter a safe root password.

Complete the MySQL installation by executing,

/usr/bin/mysql_secure_installation

When asked for a password, enter the MySQL password you just created. Continue through the installation process.

Would you like to setup VALIDATE PASSWORD plugin? [Y/N] N
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

Step 3: Installing PHP

Joomla! requires PHP to be installed. Execute the following command to install PHP 7.0 and some required PHP modules.

apt-get install php7.0 libapache2-mod-php7.0 php7.0-mcrypt php7.0-xml php7.0-curl php7.0-json php7.0-cgi 

PHP will be installed.

Step 4: Confirming the installation of LAMP

In order to confirm that the LAMP installation was successful, open a web browser and navigate to your server's IP address. You should 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:

nano /var/www/html/index.php

And enter sample PHP code such as:

<?php
phpinfo();
?>

Navigate to your server in a browser. You should see a page with information about your PHP installation, confirming that PHP has been installed successfully.

Now remove the index.php file,

rm /var/www/html/index.php

Step 5: Installing Joomla! files

Once you have successfully installed the LAMP stack, you can proceed with installing Joomla!. Navigate to your Apache web server's root and download Joomla!.

cd /var/www/html
wget https://downloads.joomla.org/cms/joomla3/3-7-5/Joomla_3-7.5-Stable-Full_Package.zip

Install unzip to be able to unzip the downloaded archive.

apt-get install unzip

Unzip the downloaded Joomla! archive.

unzip Joomla_3-7.5-Stable-Full_Package.zip

Activate the .htaccess file by renaming it.

mv htaccess.txt .htaccess

Set the appropriate file permissions,

chown -R www-data.www-data /var/www/html
chmod -R 755 /var/www/html

Step 6: Creating a Joomla! MySQL database

Before proceeding with the installation you will need a MySQL database for Joomla!. Enter the MySQL console.

mysql -u root -p

Enter the root password you created in Step 2 to proceed. Once you are logged in to the MySQL console, create a new database for Joomla!..

mysql>CREATE DATABASE joomla;

Create a new user and grant it privileges to the Joomla! database. You can replace username and password with the username and password of your choice.

mysql>GRANT ALL PRIVILEGES on joomla.* to 'username'@'localhost' identified by 'password';
mysql>FLUSH PRIVILEGES;

Exit the MySQL console.

mysql>exit

Step 7: Installing Joomla!

Restart the Apache web server,

systemctl restart apache2

Open a browser and navigate to your server's IP. You will see the Joomla! web interface. Continue through the installation process. In the Database Configuration section, you must enter the MySQL username, password and database you created in Step 6. In this case it would be,

Database Type: MySQLi
Host Name: localhost
Username: username
Password: password
Database Name: joomla
Table Prefix: joomla_
Old Database Process: Remove

Once you have entered the data, click 'Next' and continue with the installation process. Your Joomla! installation is complete!

Want to contribute ?

You could earn up to $300 by adding new articles