Joomla is a popular open-source content management system (CMS) that helps you create websites and online applications. In this guide, we will walk through installing Joomla on Ubuntu 22.04 using Apache as the web server and securing it with a free SSL certificate from Let's Encrypt. This setup is perfect whether you're hosting Joomla locally or on a Windows VPS UK.
Step 1: Update Your System
First, ensure your system is up to date by running the following commands to update your package list and upgrade installed packages:
sudo apt update && sudo apt upgrade -y
This step ensures that your server has the latest security updates, which is especially important when deploying your Joomla site on a VPS Windows Servers environment.
Step 2: Install Apache, MySQL, and PHP
Joomla requires a web server, a database, and PHP. Use the following command to install Apache, MySQL, and PHP along with the required PHP modules:
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql php-curl php-json php-cgi php-xml php-mbstring php-zip php-intl -y
After installation, start and enable Apache and MySQL:
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql
Step 3: Configure MySQL Database for Joomla
Log in to the MySQL shell to create a database and user for Joomla:
sudo mysql -u root -p
In the MySQL shell, run the following commands to create the Joomla database and user:
CREATE DATABASE joomla_db;
CREATE USER 'joomla_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON joomla_db.* TO 'joomla_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace your_password
with a strong password of your choice.
Step 4: Download and Install Joomla
Next, download the latest Joomla package from the official website. Navigate to the Apache web root and download Joomla:
cd /var/www/html
sudo wget https://downloads.joomla.org/cms/joomla3/3-9-28/Joomla_3-9-28-Stable-Full_Package.zip
Extract the downloaded archive:
sudo apt install unzip
sudo unzip Joomla_3-9-28-Stable-Full_Package.zip -d joomla
Set the correct ownership and permissions for the Joomla directory:
sudo chown -R www-data:www-data /var/www/html/joomla
sudo chmod -R 755 /var/www/html/joomla
Step 5: Configure Apache for Joomla
Now, configure Apache to serve the Joomla site. Create a new virtual host configuration file for Joomla:
sudo nano /etc/apache2/sites-available/joomla.conf
Add the following configuration to the file:
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/joomla
ServerName yourdomain.com
ServerAlias www.yourdomain.com
<Directory /var/www/html/joomla/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save and close the file. Then, enable the Joomla site and the Apache rewrite module:
sudo a2ensite joomla.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
Step 6: Obtain a Free SSL Certificate with Let's Encrypt
To secure Joomla with HTTPS, you can use Certbot to obtain a free Let's Encrypt SSL certificate. First, install Certbot:
sudo apt install certbot python3-certbot-apache -y
Next, obtain the SSL certificate:
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
Certbot will automatically configure your Apache virtual host to use the SSL certificate. You will now be able to access your Joomla site securely using HTTPS.
Step 7: Complete Joomla Installation
Open your web browser and navigate to http://yourdomain.com
to access the Joomla installation page. Follow the on-screen instructions to set up Joomla, providing the database details created earlier.