
Here’s how to install Joomla on your Ubuntu 20.04 or 18.04 server, setting up a robust platform for your website or application. This process involves installing and configuring the necessary web server, database, and PHP components, followed by deploying the Joomla files.
To begin, you need a server running Ubuntu 20.04 or 18.04 with root or sudo privileges and an internet connection. The installation requires a LAMP stack (Linux, Apache, MySQL/MariaDB, PHP).
Step 1: Update System Packages
Always start by ensuring your package list is current.
Run the command: sudo apt update && sudo apt upgrade -y
Step 2: Install Apache Web Server
Apache is a popular choice for serving web content.
Install it using: sudo apt install apache2 -y
Verify it’s running: sudo systemctl status apache2
Step 3: Install MariaDB Database Server
Joomla requires a database. MariaDB is a community-developed fork of MySQL and works well.
Install MariaDB: sudo apt install mariadb-server mariadb-client -y
Secure the installation: sudo mysql_secure_installation (Follow the prompts to set a root password, remove anonymous users, disallow remote root login, etc.)
Verify service status: sudo systemctl status mariadb
Step 4: Create a Database and User for Joomla
Access the MariaDB shell: sudo mysql -u root -p
You will be prompted for the root password you set.
Inside the shell, create a database (replace joomladb
with your desired database name): CREATE DATABASE joomladb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Create a user and grant privileges (replace joomlauser
and your_password
):
CREATE USER ‘joomlauser’@’localhost’ IDENTIFIED BY ‘your_password’;
GRANT ALL PRIVILEGES ON joomladb.* TO ‘joomlauser’@’localhost’;
FLUSH PRIVILEGES;
EXIT;
Step 5: Install PHP and Necessary Extensions
Joomla requires PHP and several extensions. The recommended PHP version depends on your Joomla version and Ubuntu release. For recent Joomla versions, PHP 7.x or 8.x is needed. Ubuntu 20.04 defaults to PHP 7.4, while 18.04 typically uses PHP 7.2.
Install PHP and essential modules:
sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-intl php-json php-xml php-mbstring php-zip php-cli -y
Enable the PHP module for Apache: sudo a2enmod php (This might be automatic)
Restart Apache to apply changes: sudo systemctl restart apache2
Step 6: Download and Extract Joomla
Navigate to a temporary directory: cd /tmp
Download the latest Joomla release package. You can find the link on the official Joomla website. Replace the URL below with the current one:
wget https://downloads.joomla.org/cms/joomla4/4-4-1/Joomla_4-4-1-Stable-Full_Package.zip -O joomla.zip (Check the Joomla website for the latest version)
Create a directory for your Joomla installation under Apache’s webroot (typically /var/www/html
):
sudo mkdir /var/www/html/joomla
Extract the downloaded archive into the new directory:
sudo unzip joomla.zip -d /var/www/html/joomla
Step 7: Set File Permissions
The web server process needs appropriate permissions to read and write files in the Joomla directory.
Set ownership to the web server user (www-data on Ubuntu):
sudo chown -R www-data:www-data /var/www/html/joomla
Set directory permissions: sudo find /var/www/html/joomla -type d -exec chmod 755 {} \;
Set file permissions: sudo find /var/www/html/joomla -type f -exec chmod 644 {} \;
Step 8: Configure Apache (Optional but Recommended Virtual Host)
Creating a virtual host configuration provides more control over your site.
Create a new configuration file: sudo nano /etc/apache2/sites-available/joomla.conf
Paste the following content (replace your_domain_or_ip
and /var/www/html/joomla
if you used a different path):
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName your_domain_or_ip
DocumentRoot /var/www/html/joomla
<Directory /var/www/html/joomla/>
Options Indexes 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 (Ctrl+X, Y, Enter).
Enable the virtual host: sudo a2ensite joomla.conf
Disable the default Apache site: sudo a2dissite 000-default.conf (Optional, if you only host Joomla)
Enable Apache’s rewrite module (often needed by Joomla): sudo a2enmod rewrite
Test the Apache configuration for syntax errors: sudo apache2ctl configtest
If the test passes, restart Apache: sudo systemctl restart apache2
Step 9: Run the Joomla Web Installer
Open your web browser and navigate to your server’s IP address or domain name (if you configured a domain and DNS). For example, http://your_domain_or_ip
.
You will see the Joomla installation page.
Fill in the required details:
- Site Name
- Super User details (Name, Username, Password, Email)
- Database Configuration (Database Type: MySQLi, Host: localhost, Username: joomlauser, Password: your_password, Database Name: joomladb)
Follow the on-screen steps to complete the installation.
After the installation is finished, crucially, remove the installation folder as instructed for security reasons.
Step 10: Secure the Installation
Remove the installation directory via the command line: sudo rm -rf /var/www/html/joomla/installation
Your Joomla site should now be accessible via your browser, ready for configuration and content creation. This comprehensive approach ensures a stable and secure base for your Joomla-powered website.
Source: https://kifarunix.com/easily-install-joomla-on-ubuntu/