Joomla is a free and open-source content management system (CMS) for creating dynamic websites. It is based on the Model-View-Controller framework for web applications and offers intuitive interfaces and a wide range of functions. Joomla is mainly written in the PHP programming language with GNU General Public License and also supports two different RDBMS (Relational Database Management System): MySQL/MariaDB and PostgreSQL.
Joomla is one of the most popular content management systems on the Internet. It is versatile: you can use Joomla for publishing web content, forums, photo galleries, e-commerce and numerous web applications. It supports multilingualism and SEO and has a great design and great features. Joomla is a very flexible CMS, extensible and customizable.
This guide will show you how to install Joomla CMS (Content Management System) with the LAMP stack (Linux, Apache2, MariaDB and PHP) on the Ubuntu 22.04 server. I will also show you how to set up the virtual Apache2 host for Joomla with SSL/HTTPS so that you end up with a secure Joomla CMS with SSL/HTTPS enabled.
Before you start with this guide, you must fulfill the following requirements:
Joomla CMS can be operated under various web servers such as Apache2, Nginx or IIS (for Windows). This guide shows you how to run Joomla with the Apache2 web server. Now install the Apache2 web server on your Ubuntu system.
Run the following apt command to update and upgrade the Ubuntu repositories before installing the Apache2 packages.
sudo apt update
Now install the Apache2 web server with the following command. Enter Y to confirm the installation and press ENTER to start the installation.
sudo apt install apache2
After the Apache2 installation is complete, run the following command to check and verify the Apache2 service. On the Ubuntu system, Apache2 is automatically activated and running. So you should see that the Apache2 service is"enabled" and automatically running on boot. And the current status of the Apache2 service is "running".
sudo systemctl is-enabled apache2 sudo systemctl status apache2
If you have the UFW firewall running on your Ubuntu system, you need to add the Apache2 rule ports to the firewall. The default installation of Apache2 comes with the UFW application rule.
Run the ufw command below to add the Apache2 service ports (80 and 443 - HTTP and HTTPS) to the UFW firewall.
sudo ufw allow "Apache2 Full" sudo ufw reload
Now check the enabled firewall rule with the following command. You should see that the "Apache2 Full" application has been added to the UFWE firewall.
sudo ufw status
Joomla can be used with two different RDBMS (Relational Database Management System) like MySQL/MariaDB and PostgreSQL. In this guide, you will learn how to install Joomla with MariaDB as the default database. So it's time to install the MariaDB database on your Ubuntu server.
Run the following apt command to install the MariaDB database server, which is available by default in the Ubuntu repository. Enter Y to confirm the installation and press ENTER to start the installation.
sudo apt install mariadb-server
After the MariaDB server installation is complete, run the following command to check and verify the MariaDB service. You should see that the MariaDB service is activated, i.e. it is automatically executed when booting. In addition, the current status of the MariaDB service is "running".
sudo systemctl is-enabled mariadb sudo systemctl status mariadb
Next, you need to set up the MariaDB deployment on your server. You can use the command line"mysql_secure_installation" to set up and configure the MariaDB server with some basic security settings. This command is available by default on every MariaDB server installation.
Execute the"mysql_secure_installation" command as follows.
sudo mysql_secure_installation
Now you will be asked for some MariaDB server settings:
This completes the installation and configuration of MariaDB.
Now that you have installed the Apache2 web server and the MariaDB database, it's time to install PHP. The latest version of Joomla requires at least PHPv7.2.5 with the recommended version of PHP 8.x. And the default repository of Ubuntu provides PHP 8.1 which is suitable for the latest version of Joomla installation.
Run the following apt command to install the PHP packages. Type Y to confirm the installation and press ENTER to continue and the PHP installation will begin.
sudo apt install libapache2-mod-php php php-cli php-mysql php-json php-opcache php-mbstring php-intl php-xml php-gd php-zip php-curl php-xmlrpc
After the PHP installation is complete, edit the configuration file"/etc/php/8.1/apache2/php.ini" with the following command. Some additional configuration is required for the installation of Joomla CMS.
sudo nano /etc/php/8.*/apache2/php.ini
Change the default PHP settings with the following configurations.
memory_limit = 256M upload_max_filesize = 80M post_max_size = 120M max_execution_time = 160
Save and close the file when you are done.
Finally, run the following command to restart the Apache2 service and apply the new changes.
sudo systemctl restart apache2
Before you start installing Joomla, you will also need to create a new MariaDB database and a new user for the Joomla installation.
Execute the following command to log in to the MariaDB shell. You will be asked for the MariaDB root password. Enter the correct password for the MariaDB root user.
sudo mysql -u root -p
Next, run the following queries to create a new MariaDB user and a new database for Joomla. In this demo, you will create the database"joomladb" with the user"joomla" and the password"yourpassword". You can also change the details of the database configuration.
CREATE DATABASE joomladb; CREATE USER joomla@localhost IDENTIFIED BY 'yourpassword'; GRANT ALL ON joomladb.* TO joomla@localhost WITH GRANT OPTION; FLUSH PRIVILEGES;
Now run the following query to check and verify the permissions of the MariaDB user "joomla". You should see that the user"joomla" has access to the database"joomldadb".
SHOW GRANTS FOR joomla@localhost; quit
Once you have created the MariaDB database and user for Joomla, it's time to download the Joomla source code to your server. At the time of this article, the latest version of Joomla v4.1.5 is stable and you will install it on the Ubuntu server.
Run the wget command below to download the Joomla source code. You will see the file"joomla.tar.bz2" in your current directory.
wget -O joomla.tar.bz https://downloads.joomla.org/cms/joomla4/4-1-5/Joomla_4-1-5-Stable-Full_Package.tar.bz2
Now create a new directory "/var/www/joomla" and extract the Joomla source code into this directory by executing the following command. The directory"/var/www/joomla" will be the default DocumentRoot for your Joomla installation.
mkdir -p /var/www/joomla sudo tar -xjf joomla.tar.bz -C /var/www/joomla
Finally, use the following command to change the ownership and permissions for the Joomla DocumentRoot directory"/var/www/joomla". The owner should be the user "www-data" and the authorization is"755".
sudo chown -R www-data:www-data /var/www/joomla sudo chmod 755 /var/www/joomla
Now you have completed the basic LAMP stack installation and created a new database and a new user for Joomla. You have also downloaded the Joomla source code to the"/var/www/joomla" directory. Now you will set up the Apache2 s=virtual host configuration for Joomla.
Before you start editing the Apache2 conf files, run the following command to enable some Apache2 modules.
sudo a2enmod rewrite ssl headers deflate
Now create a new virtual host configuration"/etc/apache2/sites-available/joomla.conf" with the following command.
sudo nano /etc/apache2/sites-available/joomla.conf
Paste the following configuration into the file. You also need to change the default domain name and the path of the SSL certificates. In this example we use the domain"hwdomain.io".
<VirtualHost *:80>
ServerName hwdomain.io
ServerAdmin admin@hwdomain.io
# Redirect Requests to SSL
Redirect permanent "/" "https://hwdomain.io/"
ErrorLog ${APACHE_LOG_DIR}/hwdomain.io.error.log
CustomLog ${APACHE_LOG_DIR}/hwdomain.io.access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerName hwdomain.io
ServerAdmin admin@hwdomain.io
DocumentRoot /var/www/joomla
# Add security
php_flag register_globals off
ErrorLog ${APACHE_LOG_DIR}/hwdomain.io.error.log
CustomLog ${APACHE_LOG_DIR}/hwdomain.io.access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/hwdomain.io/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hwdomain.io/privkey.pem
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /var/www/joomla>
Options None FollowSymLinks
#Allow .htaccess
AllowOverride All
Require all granted
<IfModule security2_module>
SecRuleEngine Off
# or disable only problematic rules
</IfModule>
</Directory>
</VirtualHost>
</IfModule> Save and close the file when you're done.
Next, run the following command to enable the"joomla.conf" virtual host configuration. Then check the Apache2 configuration. If your configuration is correct, you will see a message like"Syntax OK". If you receive an error message, check the "joomla.conf" configuration file again.
sudo a2ensite joomla.conf sudo apachectl configtest
Finally, execute the following command to restart the Apache2 service and apply the configuration of the virtual host "joomla.conf".
sudo systemctl restart apache2
To start the Joomla installation, open the web browser and visit the Joomla domain (e.g. https://hwdomain.io). You should see the Joomla installation page.
Select the language for your Joomla installation. Then enter the site name for your Joomla and click on"Set up login data".
Enter the new admin user, password and e-mail address for your Joomla installation and click on"Set up database connection".
Select"MySQLi" as the database type. Then enter the database name, the user, the password and the database prefix. Finally, click on"Install Joomla".
After the Joomla installation is complete, you will see a message like "Congratulations! Your Joomla website is ready.". Click on"Open page" to open the default homepage of your Joomla installation or click on"Open administrator" to visit the Joomla administrator login page.
You will see the default Joomla home page as shown in the screenshot below.
For the Joomla administrator login, you can go to the path URL"/administrator" (i.e. https://hwdomain. io/administrator/). Enter the Joomla administrator user and password and then click on"Login".
If your admin user and password are correct, you will see the Joomla administrator dashboard as follows.
Congratulations! You have now successfully installed Joomla CMS with the LAMP stack on the Ubuntu 22.04 server. Now you have also secured your Joomla installation with the SSL/HTTPS connections. Now you may want to secure your Joomla installation by changing the default admin page or installing some plugins and themes to extend the features of Joomla.
Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…
ISPConfig is an open-source control panel that allows users to manage multiple servers from a…
As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…
Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…
Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…
phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…