Updated: 28 September 2026 · Applies to: Drupal 11.4 on Ubuntu 24.04, AlmaLinux 9 and Rocky Linux 9 (PHP 8.3)
Ubuntu 16.04 and PHP 7 are end of life. This guide installs Drupal 11 (current version 11.4) with Apache on Ubuntu 24.04 (AlmaLinux/Rocky 9 work the same way).
Note: This needs PHP 8.3 or newer: Ubuntu 24.04 and AlmaLinux/Rocky 9 (with the php:8.3 stream) are fine. Debian 12 ships PHP 8.2, which is too old for it.
Before you start
- A VPS or dedicated server with a fresh Ubuntu 24.04 / Debian 12 or AlmaLinux 9 / Rocky Linux 9 installation, and root or sudo access.
- A domain or subdomain pointing to the server (an A record), if you want HTTPS.
- The system updated:
apt update && apt upgradeordnf upgrade.
Install Apache, MariaDB and PHP
Ubuntu 24.04 / Debian 12:
apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-xml php-mbstring php-curl php-zip php-gd php-intl systemctl enable --now apache2 mariadb
AlmaLinux 9 / Rocky Linux 9 (choose a current PHP stream first):
dnf module reset php && dnf module enable php:8.3 dnf install httpd mariadb-server php php-fpm php-mysqlnd php-xml php-mbstring php-gd php-intl php-opcache php-pecl-zip systemctl enable --now httpd mariadb php-fpm
Secure MariaDB (set a root password or keep socket login, remove test data): mariadb-secure-installation.
Install Composer
apt install composer # Ubuntu 24.04 / Debian 12
# or the official installer (any system):
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
Create a database
mariadb -u root -p CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'Strong-Password'; GRANT ALL PRIVILEGES ON drupal.* TO 'drupaluser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Create the Drupal project
cd /var/www composer create-project drupal/recommended-project drupal cd drupal && mkdir -p web/sites/default/files cp web/sites/default/default.settings.php web/sites/default/settings.php chown -R www-data:www-data web/sites/default # apache on AlmaLinux/Rocky
The web server must serve the web folder, not the project folder.
Create the Apache site
Create /etc/apache2/sites-available/example.com.conf (Ubuntu/Debian) or /etc/httpd/conf.d/example.com.conf (AlmaLinux/Rocky):
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/drupal/web
<Directory /var/www/drupal/web>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Ubuntu/Debian: a2ensite example.com && a2enmod rewrite && systemctl reload apache2. AlmaLinux/Rocky: apachectl configtest && systemctl reload httpd.
Run the installer
Open http://example.com, choose the language and the Standard profile, enter the database details, and create the admin account. Afterwards make settings.php read-only: chmod 444 web/sites/default/settings.php.
Add a free SSL certificate
apt install certbot python3-certbot-apache # Ubuntu / Debian dnf install epel-release && dnf install certbot python3-certbot-apache # AlmaLinux / Rocky certbot --apache -d example.com -d www.example.com
Certbot installs a timer that renews the certificate automatically; test it with certbot renew --dry-run.
Note: On AlmaLinux 9 / Rocky Linux 9 SELinux is on. Let Apache/Nginx write where the application needs it, for example: semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/drupal/web/sites/default/storage(/.*)?" && restorecon -R /var/www/drupal/web/sites/default, and allow outgoing connections if the app calls APIs: setsebool -P httpd_can_network_connect 1.
Tip: Install Drush for command-line management: composer require drush/drush in the project folder, then vendor/bin/drush status. Update Drupal with composer update "drupal/core-*" --with-all-dependencies followed by vendor/bin/drush updatedb.
Tip: On Ucartz cPanel hosting you can install many of these applications in a few clicks with Software › Softaculous Apps Installer, which also handles updates and backups.