Install Drupal on Ubuntu 24.04 with this easy step-by-step guide. Our Drupal Support team is ready to assist you. 

Install Drupal on Ubuntu 24.04

Drupal is a powerful CMS trusted for its flexibility, scalability, and security. It supports multilingual content, mobile responsiveness, and thousands of modules to build tailored websites. In this guide, we’ll prepare Ubuntu 24.04, set up the required server stack, and install Drupal step by step.

Why Use Drupal

Drupal CMS is a powerful platform valued for its customizability, offering thousands of modules and themes to create tailored solutions; its scalability, handling everything from small sites to enterprise-level portals; its security-focused foundation, trusted by governments and institutions worldwide; its multilingual support, enabling content in over 100 languages; and its mobile-responsive design, ensuring seamless accessibility across all devices.

How to Install Drupal on Ubuntu 24.04: Step-by-Step Guide

Preparing Ubuntu 24.04

Before installing Drupal, ensure your system is updated and ready with the necessary tools.

  1. Update Package List
    Refresh the local package index to make sure you have the latest versions and security patches:
sudo apt update
  1. Install Required Dependencies
    Install common dependencies used for building and installing software:
sudo apt install build-essential curl wget software-properties-common
  • build-essential – Provides GCC, g++, make, and libraries for compiling software
  • curl and wget – Tools for downloading files
  • software-properties-common – Helps manage repositories and PPAs

Setting Up Web Server and Database on Ubuntu 24.04

To run Drupal, you need a web server and a database system. Ubuntu 24.04 supports both Apache2 or Nginx as web servers and MariaDB or MySQL as database servers. You can also choose to set up Drupal with PHP-FPM and Nginx on Ubuntu for better performance and flexibility.

  1. Install and Configure Apache2 or Nginx
  • Apache2 Installation:
sudo apt update
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl status apache2

Configuration files:

  • Main config – /etc/apache2/apache2.conf
  • Virtual hosts – /etc/apache2/sites-available/
    Enable or disable a site:
sudo a2ensite your-site.conf
sudo a2dissite your-site.conf
sudo systemctl reload apache2
  • Nginx Installation:
sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx

Configuration files:

  • Main config – /etc/nginx/nginx.conf

  • Server blocks – /etc/nginx/sites-available/

    Enable a site:

sudo ln -s /etc/nginx/sites-available/your-site.conf /etc/nginx/sites-enabled/
sudo systemctl reload nginx
  1. Install and Secure MariaDB or MySQL
  • MariaDB Installation:
sudo apt install mariadb-server -y
sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure installation:
sudo mysql_secure_installation

Create a database and user:
CREATE DATABASE drupaldb;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'StrongPass';
GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES; EXIT;
  • MySQL Installation:
sudo apt install mysql-server -y
sudo systemctl start mysql
sudo systemctl enable mysql
sudo mysql_secure_installation

Installing PHP and Required Extensions on Ubuntu 24.04

  1. Update Package List
    Make sure your system package index is up to date:
sudo apt update
  1. Install PHP
    You can install the default PHP version available in Ubuntu 24.04 (typically PHP 8.3):
sudo apt install php -y

Or install a specific version (e.g., PHP 8.4 if supported):
sudo apt install php8.3 -y
  1. Install Common PHP Extensions
    Drupal requires several extensions to function correctly:
sudo apt install php-mysql php-gd php-xml php-cli php-curl php-zip php-mbstring -y

Add or remove extensions depending on your project’s requirements.

  1. Verify PHP Installation
    Check installed PHP version:
php -v

List installed modules:
php -m
  1. Confirm PHP with Web Server
    Create a phpinfo.php file in your web root (e.g., /var/www/html/):
<?php
phpinfo();
?>

Access it in your browser:
http://your-server-ip/phpinfo.php

Remove this file after testing to avoid exposing server details.

Downloading and Configuring Drupal

  1. Install Apache, PHP, and MariaDB
sudo apt update
sudo apt install apache2 mariadb-server php php-mysql php-gd php-xml php-mbstring php-curl php-zip unzip -y
  1. Create Database
sudo mysql -u root -p
CREATE DATABASE drupaldb;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES; EXIT;
  1. Download and Extract Drupal
cd /var/www/
sudo wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
sudo tar -xzvf drupal.tar.gz
sudo mv drupal-* drupal
sudo chown -R www-data:www-data /var/www/drupal
  1. Configure Apache
sudo nano /etc/apache2/sites-available/drupal.conf
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/drupal
<Directory /var/www/drupal>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
sudo a2ensite drupal.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
  1. Finish in Browser

Go to http://your-domain.com, follow the wizard, and enter DB details.

  1. Secure Config
sudo chmod 644 /var/www/drupal/sites/default/settings.php

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

With the steps outlined above, you can successfully install Drupal on Ubuntu 24.04 and build a secure, scalable, and customizable website. By setting up the right server environment and configuring Drupal properly, you’re ready to create powerful digital experiences that grow with your needs.

In brief, our Support Experts demonstrated how to fix the “554 5.7.1 : Relay access denied” error.