Installing Joomla 4 on Ubuntu 21.04

Hello,

In this week’s feature highlight, we look at How to Install Joomla 4 on Ubuntu 21.04

Joomla is a free and open-source content management system for publishing web content on websites. Web content applications include discussion forums, photo galleries, e-Commerce, and user communities, and numerous other web-based applications.

Let us first check for any pending updates in the Ubuntu server and install if any are available.

apt update

apt upgrade

LAMP Stack Configuration

Joomla like any other CMS application, will require a web server with Database running on the system to support it. And since Joomla is built on PHP, we will need to install PHP as well.

Install Apache and PHP

We will now install Apache and PHP and other supporting packages by running the below command,

sudo apt install apache2 libapache2-mod-php openssl php-imagick php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip

Verify apache version using below command

apache2 -version

Output:

user1@server:~$ apache2 -version
Server version: Apache/2.4.46 (Ubuntu)
Server built:   2021-06-17T17:09:41

Now start and enable the Apache Webserver

systemctl start apache2 
systemctl enable apache2

Verify Apache is up and running using below command

systemctl status apache2

Output:

root@server:~# systemctl enable apache2
Synchronizing state of apache2.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable apache2
root@server:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor pre>
     Active: active (running) since Tue 2021-08-17 13:34:31 UTC; 7min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 31226 (apache2)
      Tasks: 6 (limit: 1039)
     Memory: 17.5M
     CGroup: /system.slice/apache2.service
             ├─31226 /usr/sbin/apache2 -k start

Open server IP address on your browser(http://Server_Ip) to see default Apache page.

Note: Replace “Server_Ip” with actual Ip address of the server

images

Verify PHP using below command

php -v  

Output:

root@server:~# php -v
PHP 7.4.16 (cli) (built: Jul  5 2021 13:04:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies

Install MariaDB

Let us install MariaDB on the server now with the following command,

sudo apt install mariadb-server

MariaDB is not secured by default, As a precaution, we are secure the database engine using below command.

sudo mysql_secure_installation

Create a Joomla Database

Login to MariaDB using the command

sudo mysql -u root -p

Let us configure the Database so Joomla can connect to it and store the data.

For this, we will create a Database, create a User and grant certain Privileges to the User. Refer the below commands for the usecase.

MariaDB [(none)]> CREATE USER 'crowncloud'@'localhost' IDENTIFIED BY 'password';
MariaDB [(none)]> CREATE DATABASE joomla_database;
MariaDB [(none)]> GRANT ALL ON joomla_database.* TO 'crowncloud'@'localhost' IDENTIFIED BY 'strongpassword';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Download and Extract Joomla

Note: At the time of writing this article, Joomla 4 had just been released.

We will now download the latest version of Joomla from the official site

Download Joomla in Ubuntu using below command

wget https://github.com/joomla/joomla-cms/releases/download/4.0.0/Joomla_4.0.0-Stable-Full_Package.zip

Once the download is complete. We need to unzip this to the /var/www/html/ directory. Make the directory called Joomla.

mkdir /var/www/html/joomla

Unzip the zipped Joomla file to ‘Joomla’ directory created above.

unzip Joomla_4.0.0-Stable-Full_Package.zip -d /var/www/html/joomla

After unzip, Set the directory ownership of the directory to Apache user and change the permissions using below command

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

Restart Apache Webserver using following command

systemctl restart apache2 

Configuring Apache for Joomla

Configure the Apache webserver to server Joomla webpages. For this create a virtual host’s files for Joomla and rename it Joomla.conf

Add the following content into the file

<VirtualHost *:80>
 ServerAdmin admin@example.com
 DocumentRoot /var/www/html/joomla/
 ServerName example.com
 ServerAlias www.example.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>

Enable the virtual hosts’ file.

a2ensite joomla.conf
a2enmod rewrite

After this Restart Apache Webserver using below command

systemctl restart apache2

Open server IP address on your browser(http://Server_IP/joomla) to see Joomla dashboard page.

Setup Site Name below

images

Enter the required details such as Username, User Account, Super User Password, and Email Address, and click on Setup Database Connection button

images

Setup Database Configuration Details, Then click on Install Joomla

images

After Setting up configuration, Press Complete and Open Admin enter in Joomla

images

Put login details Username and Password to get dashboard

images

Dashboard will look like this

images

Done! This concludes the topic of installing latest version of Joomla on Ubuntu 21.04.

(Visited 1,718 times, 1 visits today)

Comments

  1. Hey,

    Thanks for this.

    Now, I’m stuck at sudo apt install mariadb-server

    I get the following response.

    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    mariadb-client-core-10.5 : Depends: libreadline5 (>= 5.2) but it is not installable
    E: Unable to correct problems, you have held broken packages.

    1. Hi,
      Just to confirm, you are on Ubuntu 21.04 ? If yes, then you can try,


      apt-get install software-properties-common
      apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
      add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.5/ubuntu hirsute main'

      Then,

      apt update
      apt install mariadb-server

Comments are closed.