Skip to content
Follow
CMS

How to install Drupal with Apache support on Ubuntu 24.04

Richard
Written by
Richard
May 28, 2024 Updated Jun 20, 2026 7 min read
How to install Drupal with Apache support on Ubuntu 24.04
How to install Drupal with Apache support on Ubuntu 24.04

You install Drupal with Apache support on Ubuntu 24.04 by configuring Apache as your web server and then setting up Drupal 10, the latest stable version. This process involves preparing your Ubuntu system and integrating Drupal’s files with Apache.

Drupal is a free and open-source content management system (CMS) known for its flexibility in building everything from personal blogs to large enterprise websites. It requires a web server like Apache to run.

Apache is a widely used, highly reliable web server that provides the necessary infrastructure for Drupal to function. Setting them up together on Ubuntu 24.04 ensures a solid foundation for your web projects.

⚡ Quick Answer

Install Apache using `sudo apt install apache2`, then set up a MariaDB database with `sudo mariadb`. Create a database and user for Drupal, and finally, install PHP.

Install Apache HTTP server on Ubuntu Linux

To run Drupal, you’ll need a web server, and Apache is a great choice for Ubuntu 24.04. Installing Apache is straightforward using a couple of commands in your terminal.

To do that, open the Ubuntu terminal and run the commands below to install the Apache web server.

🐧Bash / Shell
sudo apt update
sudo apt install apache2

Once Apache is installed, the commands below can start, stop, and enable the Apache web server to start automatically when your server boots up.

🐧Bash / Shell
sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl enable apache2

You test that the Apache web server is running by opening your web browser and browsing to the server’s localhost or IP address.

http://localhost

Apache2 Default Page
Apache2 Default Page

When you see the Apache2 Default Page, it means the Apache HTTP server is successfully installed.

Additional help on installing Apache on Ubuntu is in the link below.

How to install Apache on Ubuntu

Install MariaDB database server on Ubuntu Linux

Drupal needs a database to store all its information, and MariaDB is a popular and reliable option for Ubuntu 24.04. You can install the MariaDB server with a simple command in the terminal.

To install and use the MariaDB database server, use the instructions below.

Open the Ubuntu terminal and run the commands below to install the MariaDB database server.

🐧Bash / Shell
sudo apt update
sudo apt install mariadb-server

Once the MariaDB database server is installed, use the commands below to stop, start, and enable the MariaDB server to start automatically when the server boots.

🐧Bash / Shell
sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

Run the following commands to validate and test if the MariaDB database server is installed successfully.

🐧Bash / Shell
sudo mariadb

Once you run the commands above, it will log you onto the MariaDB console and display a message similar to the one below.

💻Code
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 32
Server version: 10.11.2-MariaDB-1 Ubuntu 23.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> 

The message tells you that the server is installed successfully.

Additional help on installing MariaDB.

Create a Drupal database

Once MariaDB is set up, you need to create a specific database for Drupal to use. This involves creating a database named ‘drupaldb’ and a user ‘drupaldbuser’ with the necessary permissions.

This database will store the Drupal application content and data.

We will create a database called drupaldb. We will also create a database user account called drupaldbuser.

Finally, we’ll grant the drupaldbuser full access to the drupaldb database.

All the database steps above can be done using the commands below:

But first, log on to the MariaDB database server:

🐧Bash / Shell
sudo mariadb

Then run the commands below to complete the steps:

💻Code
CREATE DATABASE drupaldb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER drupaldbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON drupaldb.* TO drupaldbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Ensure to replace ‘type_your_password_here‘ with your password.

Install PHP on Ubuntu Linux

Drupal is built with PHP, so you need to install it on your Ubuntu 24.04 system to make Drupal work. Installing PHP and the necessary modules is done with a single command in the terminal.

Run the commands below to install PHP.

🐧Bash / Shell
sudo apt install php libapache2-mod-php php-intl php-mysql php-curl php-cli php-zip php-gd php-common php-mbstring php-xml php-opcache php-readline php-sqlite3 php-zip php-apcu

Additional help on installing PHP

How to install PHP on Ubuntu Linux

Download Drupal files

With the server components ready, it’s time to download the Drupal files themselves onto your Ubuntu 24.04 system. You’ll download Drupal and place its files into the correct directory for Apache to access.

The command block below will download and create a new Drupal folder in the Apache root directory.

First, create a Drupal folder in the Apache root directory.

Please change it to the /tmp directory and download Drupal files. Unzip the file and move the content into the created Drupal folder.

Finally, the permissions should be changed to allow the Apache web server to interact with the files.

🐧Bash / Shell
sudo mkdir -p /var/www/drupal
cd /tmp/
wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
tar -xvf drupal.tar.gz
sudo mv drupal-*/* /var/www/drupal
sudo chown -R www-data:www-data /var/www/drupal/
sudo chmod -R 755 /var/www/drupal/

Once you have completed all the above steps, continue below to configure the Apache web server to serve the Drupal content.

Run the commands below to create an Apache virtual host file for Drupal.

🐧Bash / Shell
sudo nano /etc/apache2/sites-available/drupal.conf

Then, copy and paste the content block below into the Apache server block.

🐘PHP
<VirtualHost *:80>
ServerName drupal.example.com
ServerAlias www.drupal.example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/drupal

<Directory /var/www/drupal/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/drupal/>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
</VirtualHost>

Save the file.

Then, run the commands below to enable the server block and restart the Apache server.

🐧Bash / Shell
sudo a2ensite drupal.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
sudo systemctl restart apache2

Setup Let’s Encrypt SSL/TLS for Drupal

To make your Drupal site secure and trustworthy, you should set up an SSL/TLS certificate using Let’s Encrypt. This process encrypts data between visitors and your server, ensuring a safe connection for your Drupal installation.

Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Apache.

How to set up Let’s Encrypt SSL certificate for Apache on Ubuntu Linux

After installing, the Apache server block file /etc/apache2/sites-available/drupal.conf will automatically be configured with HTTPS, done by the Certbot Apache plugin.

Once you have restarted the Apache web server, open your browser and browse to the server hostname or IP address defined in the Apache server block.

💻Code
http://drupal.example.com

A new Drupal installation wizard will appear. Choose a language and continue to the next page.

Drupal setup choose language
Drupal setup choose language

Next, select the installation profile.

Drupal installation profile selection screen during setup on Ubuntu 24.04
Drupal installation profile selection screen during setup on Ubuntu 24.04

Then, type in the database name, username, and password created above.

Drupal setup database entries
Drupal setup database entries

Finally, set up your site name and create an admin account to login in.

Site configuration settings page for a new Drupal installation on Apache
Site configuration settings page for a new Drupal installation on Apache

Your new Drupal site should be created and ready to use.

Drupal setup complete
Drupal setup complete

That should do it!

Conclusion:

  • Installing Drupal with Apache support on Ubuntu is a robust choice for creating and managing websites of varying complexities.
  • Combining Apache and Drupal ensures compatibility with modules and extensions, creating a stable and efficient environment.
  • Let’s Encrypt SSL/TLS for Drupal to secure the site with HTTPS, enhancing its security and trustworthiness.
  • The step-by-step guide provided comprehensive instructions for installing and configuring Drupal with Apache support, ensuring a successful setup.
  • Users are encouraged to provide feedback or seek additional assistance via the comments section for queries or improvements.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Start, Stop, and Restart Services in Windows 11
Windows How to Start, Stop, and Restart Services in Windows 11
How to Install Drupal with Nginx and Cloudflare on Ubuntu
CMS How to Install Drupal with Nginx and Cloudflare on Ubuntu
How to Install i-doit on Ubuntu with Apache
CMS How to Install i-doit on Ubuntu with Apache
Install Drupal with Lighttpd on Ubuntu 24.04
CMS Install Drupal with Lighttpd on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *