Docs / CMS & Website Platforms / How to Install Drupal on a VPS

How to Install Drupal on a VPS

By Admin · Mar 1, 2026 · Updated Apr 23, 2026 · 25 views · 2 min read

What Is Drupal?

Drupal is a highly flexible open-source CMS known for its robust security and scalability. It powers government websites, universities, and large-scale enterprise platforms. Drupal excels at handling complex content structures and workflows.

Prerequisites

  • A Breeze with at least 2 GB RAM running Ubuntu 22.04+
  • PHP 8.2+ with required extensions
  • Apache or Nginx web server
  • MySQL 8.0+ or MariaDB 10.6+
  • Composer installed

Step 1: Install PHP Extensions

sudo apt install php-gd php-xml php-mbstring php-curl php-zip php-mysql php-opcache

Step 2: Create the Database

sudo mysql -u root -p
CREATE DATABASE drupal_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'SecurePass456';
GRANT ALL PRIVILEGES ON drupal_db.* TO 'drupal_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Install Drupal via Composer

cd /var/www
sudo composer create-project drupal/recommended-project drupal
sudo chown -R www-data:www-data /var/www/drupal
sudo chmod -R 755 /var/www/drupal

Step 4: Configure the Web Server

sudo nano /etc/apache2/sites-available/drupal.conf
<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/drupal/web
    <Directory /var/www/drupal/web>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
sudo a2ensite drupal.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 5: Run the Web Installer

Visit your domain in a browser. Select the installation profile, enter the database credentials, and configure your site name and admin account. After installation, navigate to Administration > Reports > Status report to verify everything is working correctly.

Recommended Next Steps

  • Enable SSL with Certbot
  • Configure the Drupal cron job for scheduled tasks
  • Set up trusted host patterns in settings.php

Was this article helpful?