How to Install Joomla on Ubuntu 18.04

 In Dedicated, VPS, Web

Prerequisites:

– A VPS / dedicated server 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.

Recommended Posts

Start typing and press Enter to search