drupal

How to Install Drupal on Ubuntu

  • Profile picture of Mcs
  • by Mcs June 27, 2025

Drupal is a free and open-source content management framework (CMF) and content management system (CMS) written in PHP. It is known for its flexibility, scalability, and customization capabilities, making it a popular choice for building complex websites and applications. Drupal offers a wide range of features, including user management, content management, and taxonomy, as well as a large community of developers and a vast array of modules and themes. When installed on Ubuntu, Drupal can take advantage of Ubuntu’s reliability, security, and scalability, making it an excellent choice for building robust and high-performance websites.

The benefits of using Drupal on Ubuntu include improved performance, enhanced security, and simplified maintenance. Ubuntu’s package manager, apt, makes it easy to install and manage dependencies, while its community support ensures that any issues are quickly resolved. In this article, we will provide a step-by-step guide on how to install Drupal on Ubuntu. We will cover the prerequisites, installing the Apache web server, configuring the firewall, installing PHP and database dependencies, creating a Drupal database and user, and completing the Drupal installation.

By following this guide, you will be able to successfully install Drupal Ubuntu 22.04 on your system server.

Installing Drupal on Ubuntu: A Step-by-Step Guide

Preparing Your Ubuntu Server for Drupal Installation

Before you begin installing Drupal on your Ubuntu server, it’s essential to ensure that your system meets the necessary requirements. In this section, we’ll outline the prerequisites and guide you through the process of updating your system and installing the Apache web server.

System Requirements

To install Drupal on Ubuntu, you’ll need:

  • A server with Ubuntu 22.04 (or the latest version) as the operating system
  • User privileges: root or non-root user with sudo privileges

Moreover, to ensure that your system packages are up-to-date, run the following command in your terminal:

ubuntu step 1

This command will update the package index and upgrade all installed packages to the latest versions available.

Installing the Apache Web Server

Apache is a popular web server software that’s widely used for hosting websites. To install Apache on Ubuntu on your system server, execute the following command:

install apache command

Once the installation is complete, start and enable the Apache service to ensure it runs automatically on system boot:

start apache

To verify that the Apache service is running, check its status with the following command:

status apache

If the service is running correctly, you should see a message indicating that Apache is active and running.

Configuring the Firewall

By default, To enable a firewall on your Ubuntu system you can install UFW on Ubuntu system. An Uncomplicated Firewall is a user-friendly configuration tool. To allow incoming traffic on the default Apache port (80), run the following command:

ufw added

This will allow incoming HTTP traffic, making your Apache server accessible from outside the local network.

Installing PHP and Database Dependencies for Drupal

In the previous section, we installed the Apache web server and configured the firewall to allow incoming traffic. Now, we’ll focus on installing the PHP and database dependencies required for Drupal.

Drupal requires PHP to function correctly. To install PHP 8.1 with the necessary extensions, execute the following command:

php install

Installing the MariaDB Database Server

MariaDB is a popular open-source database management system that’s widely used for web applications. To install the MariaDB database server, execute the following command:

mariab-server

Since the installation is complete, start and enable the MariaDB service to ensure it runs automatically on system boot:

start mariab

To verify that the MariaDB service is running, check its status with the following command:

status mariab

If the service is running correctly, you should see a message indicating that MariaDB is active and running.

Creating a Drupal Database and User

To create a Drupal database and user, you’ll need to access the MariaDB shell. You can do this by running the following command:

mariadb -U

This will open the MariaDB shell, where you can execute the following commands to create a Drupal database and user:

create user

To download Drupal, navigate to the default Apache document root:

strong password

Replace your password with a strong password for the Drupal user.

zip file

Next, unzip the downloaded file:

extracted files

Move the extracted files to a new directory named Drupal:

drupal 10

To ensure that Drupal can write to the necessary files and folders, set the correct permissions:

drupal -r data

This command sets the ownership of the drupal directory and all its contents to the www-data user and group.

Creating an Apache Virtual Host File

To create a virtual host file for Drupal, navigate to the Apache configuration directory:

available site

Create a new file named drupal.conf:

drupal conf

Next, open the file and paste the following configuration:

virtual host

Replace yourdomain.com with your actual domain name then save and close the file.

Enabling the Apache Configuration and Rewrite Module

To enable the Apache configuration for Drupal, run the following command:

apache reload

Next, enable the Apache rewrite module:

modual

Checking the Syntax and Restarting Apache

To check the syntax of the Apache configuration, run the following command:

apache -t

Completing the Drupal Installation

Once the Apache service is restarted, you can complete the Drupal installation by accessing http://yourdomain.com in your web browser. Follow the on-screen instructions to complete the installation:

installing drupal

Conclusion

In this article, we have provided a comprehensive guide on how to install Drupal on Ubuntu. The steps performed to install and set up Drupal on Ubuntu include installing the Apache web server, configuring the firewall, and installing PHP and database dependencies.

Next, we created a Drupal database and user, downloading and unzipping the Drupal installation files, creating an Apache virtual host file, enabling the Apache configuration and rewrite module, and restarting the Apache service.

Finally, we completed the Drupal installation by accessing the website in a web browser and following the on-screen instructions. By following these steps, you should now have a fully functional Drupal installation on your Ubuntu server, ready to be customized and developed into a robust and high-performance website.

Comments

Good Article

Add new comment

Restricted HTML

  • Allowed HTML tags: <br> <p> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <cite> <dl> <dt> <dd> <a hreflang href> <blockquote cite> <ul type> <ol type start> <strong> <em> <code> <li>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.