How to Install Joomla on Ubuntu 18.04

Install Joomla on Ubuntu

Joomla is a content management system that allows you to develop websites and publish web content easily in a user-friendly way. It is open-source, free to use and is built on a mobile-ready model–view–controller web application framework. In this tutorial, we will show you how to install Joomla on Ubuntu 18.04. It should work everywhere but we will do this on one of our Joomla hosting servers.

Prerequisites:

– A VPS running Ubuntu 18.04
– Administrative sudo user with root privileges

1. Connect to your Server

To connect to your server via SSH as user root, use the following command:

ssh root@IP_ADDRESS -p PORT_NUMBER

and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

sudo apt-get update
sudo apt-get upgrade

2. Install the MySQL Database Server

Next, we will install the MySQL server. To install the default package, run the following command:

sudo apt-get install mysql-server

This will install MySQL 5.7 on your server, but it will not prompt you to set a password or make any other configuration changes. Because this leaves your installation of MySQL insecure, in order to improve the security of your MySQL server, we recommend that you run the ‘mysql_secure_installation‘ script by typing the following command:

mysql_secure_installation

This script will help you to perform important security tasks like setting up a root password, disable remote root login, remove anonymous users, etc.

3. Create a Database for Joomla

Now, we will create our MySQL database for our Joomla site. Log in to your MySQL server with the following command and enter your MySQL root password:

sudo mysql -u root -p

In this section, we will create a new MySQL database joomla and assign user access to it to a new user admin_user with password Strong_Password:

CREATE DATABASE joomla;
GRANT ALL PRIVILEGES ON joomla.* TO 'admin_user'@'localhost' IDENTIFIED BY 'Strong_Password';
FLUSH PRIVILEGES;
exit;

Don’t forget to replace ‘Strong_Password’ with an actual strong password.

4. Install Apache and PHP

To install the Apache web server, run the following command:

sudo apt-get install apache2

After the installation is complete, you should enable Apache to start automatically upon server reboot with:

sudo systemctl enable apache2

You can also check the status of your Apache service with the following command:

sudo systemctl status apache2

Output:

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running)
 Main PID: 905 (apache2)
    Tasks: 7 (limit: 1110)
   CGroup: /system.slice/apache2.service
           ├─  905 /usr/sbin/apache2 -k start
           ├─  923 /usr/sbin/apache2 -k start
           ├─  926 /usr/sbin/apache2 -k start
           ├─  927 /usr/sbin/apache2 -k start
           ├─  928 /usr/sbin/apache2 -k start
           ├─  929 /usr/sbin/apache2 -k start
           └─16816 /usr/sbin/apache2 -k start

Since Joomla is a PHP-based application, our next step is to install PHP and some PHP extensions required by Joomla:

sudo apt-get install php php-xml php-mysql php-zip

Restart the Apache web server to load the PHP modules:

sudo systemctl restart apache2

Now check the PHP version installed on your server:

php -v

Output:

PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

5. Download Joomla

Next, run the commands below to download the latest release of Joomla.

wget https://downloads.joomla.org/cms/joomla3/3-9-1/joomla_3-9-1-stable-full_package-zip?format=zip

Then run the commands below to install & unzip the package, create a Joomla directory in the Apache document root directory, and extract the Joomla archive file.

sudo mkdir -p /var/www/html/joomla
sudo unzip joomla_3-9-1-stable-full_package-zip?format=zip -d /var/www/html/joomla

Set the directory permissions accordingly:

sudo chown -R www-data:www-data /var/www/html/joomla
sudo chmod -R 755 /var/www/html/joomla

6. Configure the Apache Web Server

Create a new virtual host configuration file for your Joomla website, named your-domain.com.conf:

sudo nano /etc/apache2/sites-available/your-domain.com.conf

And add the following content to the file:

<VirtualHost *:80>
     ServerAdmin admin@your-domain.com
     DocumentRoot /var/www/html/joomla/
     ServerName your-domain.com
     ServerAlias www.your-domain.com

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

     <Directory /var/www/html/joomla/>
            Options FollowSymlinks
            AllowOverride All
            Require all granted
     </Directory>

</VirtualHost>

Save the file and exit.

To enable the virtual host we have just created, run the following command:

ln -s /etc/apache2/sites-available/your-domain.com.conf /etc/apache2/sites-enabled/your-domain.com.conf

Restart Apache for the changes to take effect:

sudo systemctl restart apache2

Open http://your-domain.com/ in your preferred web browser and finish the installation steps.
That’s it. If you followed all of the instructions properly, you should now be able to complete the Joomla installation on your Ubuntu 18.04 server.


Of course, you don’t have to install Joomla on Ubuntu 18.04 if you use one of our managed VPS hosting services, in which case you can simply ask our expert Linux admins to install Joomla on your Ubuntu 18.04 server for you. They are available 24×7 and will take care of the Joomla installation immediately. You can also check our guide on How to Install Joomla with Nginx on Ubuntu 18.04.

PS. If you liked this post on how to install Joomla on Ubuntu 18.04, please share it with your friends on the social networks using the buttons below, or if you have any questions simply leave a comment, and our system administrators will reply to it as quickly as possible. Thanks.

3 thoughts on “How to Install Joomla on Ubuntu 18.04”

    • Joomla 1.5 is outdated. It works with PHP 5.3, and PHP 7.2 is included in the default Ubuntu repository for 18.04. It is best to upgrade and use Joomla 3.x version.

      Reply
  1. Hi,

    Just wanted to say thank you so much because I searched in a lot of websites, and none were able to give me the correct way to install joomla. But after a lot of days I found this website and in 15 minutes I had Joomla installed.

    Reply

Leave a Comment