How to install Joomla 3 on Ubuntu 16.04

how to install joomla 3 on ubuntu 16.04 In this post we will explain how to install Joomla on Ubuntu 16.04, with MariaDB 10.2, PHP-FPM 7.1 and Nginx. Joomla is an open-source content management system (CMS) for publishing web content written in PHP. Joomla is one of the most popular CMSs and it is used all over the world to power millions of websites of all shapes and sizes. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 16.04 VPS.

Before you start

Update the system and install necessary packages

sudo apt update && sudo apt -y upgrade
sudo apt install software-properties-common nano

Install MariaDB 10.2

If you already have MySQL or MariaDB installed you can skip this step and move to the next section. To add the MariaDB repository to your sources list and install the latest MariaDB server, run the following commands:

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.jaleco.com/mariadb/repo/10.2/ubuntu xenial main'
sudo apt update
sudo apt install -y mariadb-server

Secure your installation

When the installation is complete, run the following command to secure your installation:

mysql_secure_installation

Create new database

Create a new database and user for the Joomla installation using the following commands:

mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE joomla;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON joomla.* TO 'joomla'@'localhost' IDENTIFIED BY 'strongpassword';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> q

Install PHP 7.1

PHP version 7.1 is not available in the default Ubuntu 16.04 repositories so we will use the Ondrej’s PPA.

sudo add-apt-repository ppa:ondrej/php
sudo apt update

Once you enable the Ondrej’s PPA you can proceed and install PHP 7.1 and all necessary PHP modules using the following command:

sudo apt install php7.1-fpm php7.1-cli php7.1-gd php7.1-opcache php7.1-mysql php7.1-json php7.1-mcrypt php7.1-xml php7.1-curl

Install Joomla

Installing Joomla is pretty easy and straightforward, first download the Joomla zip archive from the Joomla download page:

wget https://downloads.joomla.org/us/cms/joomla3/3-8-5/Joomla_3-8-5-Stable-Full_Package.zip

Once the download is completed, unzip the archive and move the extracted files to the /var/www/my.joomla.site directory, which will be the root directory of your new Joomla site:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
sudo mkdir -p /var/www/my.joomla.site
sudo unzip Joomla_3-8-5-Stable-Full_Package.zip -d /var/www/my.joomla.site

Finally change the ownership of the /var/www/my.joomla.site directory to the www-data user:

sudo chown -R www-data: /var/www/my.joomla.site

Install and configure Nginx

If you don’t have Nginx installed on your server, you can install the latest stable version from the official Ubuntu repositories:

sudo apt -y install nginx

Next, create a new Nginx server block:

sudo nano /etc/nginx/sites-available/my.joomla.site
server {
    listen 80;
    server_name my.joomla.site;
    root /var/www/my.joomla.site;

    index index.html index.htm index.php;

    charset utf-8;

    access_log /var/log/nginx/my.joomla.site.access.log;
    error_log /var/log/nginx/my.joomla.site.error.log info;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~* /(images|cache|media|logs|tmp)/.*.(php|pl|py|jsp|asp|sh|cgi)$ {
        return 403;
        error_page 403 /403_error.html;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ .php$ {
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi.conf;
    }

    location ~ /.(?!well-known).* {
        deny all;
    }
}

Activate the server block by creating a symbolic link:

sudo ln -s /etc/nginx/sites-available/my.joomla.site /etc/nginx/sites-enabled/my.joomla.site

Test the Nginx configuration and restart nginx:

sudo nginx -t
sudo service nginx restart

Open http://my.joomla.site/ in your favorite web browser and follow the on-screen instructions to complete the Joomla installation. That’s it. You have successfully installed Joomla on Ubuntu 16.04. For more information about how to manage your Joomla installation, please refer to the official Joomla documentation.


Of course you don’t have to install Joomla on Ubuntu 16.04, if you use one of our managed VPS hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately. PS. If you liked this post on how to install Joomla on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

2 thoughts on “How to install Joomla 3 on Ubuntu 16.04”

    • Make sure to replace all occurrences of my.joomla.site with your actual domain name. Also, check the DNS records of your domain name and make sure that your domain is properly pointed to your actual server IP address.

      Reply

Leave a Comment