// blog

How to Install and Configure Drupal on a Linux VPS: Complete Guide

September 10, 2026 · by Alex M.

How to Install and Configure Drupal on a Linux VPS: Complete Guide

Drupal is one of the most powerful open-source content management systems in the world. Unlike WordPress, Drupal excels at sites with complex data structures — government portals, educational platforms, enterprise applications, and large media sites. If you need maximum flexibility and full control over your site's architecture, Drupal is a compelling choice.

In this guide, you'll learn how to install and configure Drupal 10 on a NVMe VPS running Ubuntu 22.04, from a blank server to a fully functional and secured website.

Why Run Drupal on a VPS Instead of Shared Hosting?

Drupal has higher resource requirements than most lightweight CMS platforms. A cPanel shared hosting plan can run Drupal for small projects, but as your site grows you'll hit PHP memory limits, concurrent process restrictions, and an inability to tune the server for Drupal's specific needs.

A VPS gives you:
- Full control over PHP, Nginx/Apache, and MariaDB configuration
- Dedicated RAM (Drupal recommends a minimum of 256 MB for PHP)
- Freedom to install any PHP extensions you need
- Fast vertical or horizontal scaling as traffic increases

For a production Drupal site, a SSD VPS or NVMe VPS is the ideal starting point.

Drupal 10 System Requirements

Before starting, make sure your VPS meets these minimum requirements:

  • OS: Ubuntu 22.04 LTS (recommended)
  • Web server: Apache 2.4+ or Nginx 1.18+
  • PHP: 8.1, 8.2, or 8.3
  • Database: MySQL 8.0+, MariaDB 10.6+, or PostgreSQL 14+
  • RAM: minimum 512 MB (1–2 GB recommended)
  • Required PHP extensions: gd, mbstring, pdo, xml, curl, zip, opcache, intl

Step 1: Update the Server and Install Dependencies

Connect to your VPS via SSH and update the package list:

sudo apt update && sudo apt upgrade -y

Install Apache, MariaDB, and PHP with all required extensions:

sudo apt install -y apache2 mariadb-server mariadb-client \n  php8.1 php8.1-cli php8.1-fpm php8.1-mysql php8.1-gd \n  php8.1-mbstring php8.1-xml php8.1-curl php8.1-zip \n  php8.1-intl php8.1-opcache php8.1-apcu \n  libapache2-mod-php8.1 unzip curl git

Enable the required Apache modules:

sudo a2enmod rewrite expires headers
sudo systemctl restart apache2

Step 2: Configure the MariaDB Database

Run the secure installation script:

sudo mysql_secure_installation

Answer Y to all prompts and set a strong root password.

Create a database and user for Drupal:

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

Note: Always use a strong, unique password and a dedicated database user per application — never the root account.

Step 3: Download and Install Drupal 10

Drupal 10 uses Composer as its official dependency manager.

Install Composer globally:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version

Create the Drupal 10 project in the web root:

cd /var/www
sudo composer create-project drupal/recommended-project drupal10

Set the correct file ownership and permissions:

sudo chown -R www-data:www-data /var/www/drupal10
sudo chmod -R 755 /var/www/drupal10
sudo chmod -R 775 /var/www/drupal10/web/sites/default/files

Step 4: Configure the Apache Virtual Host

Create a virtual host configuration file for Drupal:

sudo nano /etc/apache2/sites-available/drupal10.conf

Add the following configuration (replace example.com with your actual domain):

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/drupal10/web

    <Directory /var/www/drupal10/web>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/drupal10-error.log
    CustomLog ${APACHE_LOG_DIR}/drupal10-access.log combined
</VirtualHost>

Enable the site and disable the default:

sudo a2ensite drupal10.conf
sudo a2dissite 000-default.conf
sudo systemctl reload apache2

Step 5: Tune PHP for Drupal

Edit php.ini to improve Drupal's performance:

sudo nano /etc/php/8.1/apache2/php.ini

Modify or add these values:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_time = 300
date.timezone = Europe/Chisinau
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 10000

Restart Apache to apply the changes:

sudo systemctl restart apache2

Step 6: Complete the Drupal Installation via Browser

Open your browser and navigate to http://example.com. You'll be greeted by the Drupal installation wizard.

Browser-based installation steps:

  1. Choose language — select English (or your preferred language)
  2. Installation profile — choose Standard for most sites or Minimal for full control
  3. Requirements review — Drupal will flag any PHP configuration issues
  4. Database setup:
    - Type: MySQL, MariaDB
    - Database name: drupal10
    - Username: drupaluser
    - Password: the password set earlier
    - Host: localhost
  5. Installation — takes 1–3 minutes
  6. Site configuration: set the site name, admin email, and administrator account

After completion, you'll land on the Drupal admin dashboard.

Step 7: Securing Your Drupal Installation

Security is critical for any public-facing CMS. Here are the essential hardening steps:

Lock Down the sites/default Directory

sudo chmod 555 /var/www/drupal10/web/sites/default
sudo chmod 444 /var/www/drupal10/web/sites/default/settings.php

Install an SSL Certificate

Every production site must run over HTTPS. Use a premium SSL certificate or free Let's Encrypt:

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache -d example.com -d www.example.com

Security Settings in settings.php

Edit /var/www/drupal10/web/sites/default/settings.php and add:

// Disable error display in production
$config['system.logging']['error_level'] = 'hide';

// Trusted host patterns
$settings['trusted_host_patterns'] = [
  '^example\.com$',
  '^www\.example\.com$',
];

Enable the Security Kit Module

Using Drush (the official Drupal CLI tool):

cd /var/www/drupal10
sudo -u www-data composer require drupal/seckit
sudo -u www-data vendor/bin/drush en seckit -y

Step 8: Optimising Drupal Performance

Drupal ships with several built-in caching mechanisms:

Enable the Internal Page Cache

In Admin → Configuration → Performance:
- Enable „Cache pages for anonymous users"
- Enable „Cache blocks"
- Set „Minimum cache lifetime" to 10–30 minutes

Aggregate CSS and JavaScript

Also in Performance:
- Check „Aggregate CSS files"
- Check „Aggregate JavaScript files"

This significantly reduces the number of HTTP requests per page load.

Redis for Advanced Caching

For high-traffic sites, integrate Redis as a cache backend:

sudo apt install redis-server php8.1-redis -y
sudo systemctl enable redis-server
cd /var/www/drupal10
sudo -u www-data composer require drupal/redis

Add to settings.php:

$settings['redis.connection']['host'] = '127.0.0.1';
$settings['redis.connection']['port'] = 6379;
$settings['cache']['default'] = 'cache.backend.redis';

Step 9: Managing Drupal with Drush

Drush is the official Drupal CLI and a major time-saver for day-to-day administration:

# Clear all caches
sudo -u www-data vendor/bin/drush cr

# Run database updates after a module upgrade
sudo -u www-data vendor/bin/drush updb -y

# Import configuration
sudo -u www-data vendor/bin/drush cim -y

# Export configuration
sudo -u www-data vendor/bin/drush cex -y

# List enabled modules
sudo -u www-data vendor/bin/drush pm:list --status=enabled

Step 10: Automated Backups and Maintenance

Setting up regular backups is non-negotiable. Create a simple backup script:

sudo nano /usr/local/bin/backup-drupal.sh
#!/bin/bash
DATE=$(date +%Y%m%d)
BACKUP_DIR="/backups/drupal"
mkdir -p $BACKUP_DIR

# Database backup
mysqldump -u drupaluser -pStrongPassword123! drupal10 | gzip > $BACKUP_DIR/db-$DATE.sql.gz

# Files backup
tar -czf $BACKUP_DIR/files-$DATE.tar.gz /var/www/drupal10/web/sites/default/files

# Keep only the last 7 backups
find $BACKUP_DIR -name '*.gz' -mtime +7 -delete

echo "Drupal backup completed: $DATE"

Make it executable and schedule it with cron:

sudo chmod +x /usr/local/bin/backup-drupal.sh
sudo crontab -e

Add this line:

0 3 * * * /usr/local/bin/backup-drupal.sh >> /var/log/drupal-backup.log 2>&1

Updating Drupal Core and Modules

Drupal 10 updates are managed entirely through Composer:

# Update Drupal core
cd /var/www/drupal10
sudo -u www-data composer update drupal/core-recommended drupal/core-composer-scaffold --with-all-dependencies

# Apply database updates
sudo -u www-data vendor/bin/drush updb -y

# Clear cache
sudo -u www-data vendor/bin/drush cr

Best practice: Always test updates in a staging environment before applying them to production. With a managed dedicated server, this step can be handled by a professional admin team.

Drupal vs WordPress: When Should You Choose Drupal?

Feature Drupal WordPress
Custom content types ✅ Native, advanced ⚠️ Via plugins
Enterprise security ✅ Excellent ⚠️ Plugin-dependent
Learning curve ⚠️ Steep ✅ Gentle
Scalability ✅ Excellent ✅ Good
Theme/plugin ecosystem ⚠️ Smaller ✅ Enormous
Suitable for small sites ⚠️ Overkill ✅ Perfect

If you need optimised WordPress hosting for a simpler site, that remains the fastest path to launch. Drupal shines in complex projects with multiple content types, granular user roles, and advanced API integrations.

Common Issues and Solutions

Error: „The provided host name is not valid"

Add trusted_host_patterns to settings.php (see Step 7).

Drupal Cannot Write to the files Directory

sudo chown -R www-data:www-data /var/www/drupal10/web/sites/default/files
sudo chmod -R 775 /var/www/drupal10/web/sites/default/files

Composer Times Out When Installing Modules

composer config --global process-timeout 600

Slow Pages or PHP Memory Errors

Increase memory_limit in php.ini to 512M and verify that OPcache is active.

Conclusion

Drupal 10 on a Linux VPS is a powerful combination for serious websites and web applications. With a properly configured LAMP stack, optimised PHP, active SSL, and automated backups, you'll have a stable, secure, and high-performing platform ready for production traffic.

If you'd rather focus on building your site than managing infrastructure, the CLIQHOST team offers server management services and NVMe VPS plans with dedicated technical support. Get in touch and we'll tailor a solution to your exact needs.

SHARE
// what clients say

What Our Clients Say

Real reviews from customers who trust CLIQHOST for performance, reliability and expert technical support.

★★★★★

"We moved our online shop from a foreign host and the difference is night and day — pages load instantly and support replies in minutes, in Romanian."

AM
Andrei M.
eCommerce owner · Chișinău
★★★★★

"Migrated 12 client sites to CLIQHOST. Free migration, zero downtime, and the cPanel setup is exactly what my team needed. Highly recommend."

EV
Elena V.
Web agency · Bălți
★★★★★

"Our NVMe VPS handles traffic spikes without a sweat. Full root, local datacenter, and billing in MDL — everything we wanted from a provider."

DC
Dmitri C.
SaaS founder · Chișinău