How to Install Drupal on a VPS

Drupal is a powerful, highly flexible open-source CMS well-suited for complex content structures, large sites, and organizations needing fine-grained content permissions. This guide covers a complete installation on a VPS.

Prerequisites

  • Ubuntu 22.04/24.04 VPS: 2 vCPU, 4 GB RAM minimum
  • Nginx or Apache, PHP 8.1+, MySQL/MariaDB or PostgreSQL
  • Composer

Step 1 — Install Required PHP Extensions

sudo apt install php8.2-gd php8.2-curl php8.2-mbstring php8.2-xml php8.2-zip php8.2-mysql php8.2-opcache -y

Step 2 — Create the Database

sudo mysql
CREATE DATABASE drupal;
CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'localhost';
FLUSH PRIVILEGES;

Step 3 — Install Drupal via Composer (Recommended Method)

composer create-project drupal/recommended-project /var/www/drupal

Step 4 — Set Correct Permissions

cd /var/www/drupal
sudo chown -R www-data:www-data web/sites/default/files
sudo chmod -R 755 web/sites/default/files

Step 5 — Configure Nginx

server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/drupal/web;
    index index.php;

    location / {
        try_files $uri /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~ ^/sites/.*/files/ {
        try_files $uri /index.php?$query_string;
    }
}
sudo ln -s /etc/nginx/sites-available/drupal /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 6 — Run the Web Installer

http://yourdomain.com

Follow the installation wizard: choose an installation profile (Standard is typical for most sites), configure the database connection, and create your administrator account.

Step 7 — Add HTTPS

sudo certbot --nginx -d yourdomain.com

Step 8 — Set Up Cron

Drupal relies on cron for maintenance tasks (search indexing, cache cleanup) — configure this under Configuration → System → Cron, or via an actual system cron job hitting Drupal's cron URL periodically.

Installing Contributed Modules

composer require drupal/pathauto

Then enable via Extend in the admin panel, or via Drush command-line tooling.

Installing Drush (Command-Line Tool)

composer require drush/drush
vendor/bin/drush status

Drush significantly speeds up common administrative tasks (cache clearing, module management, database operations) compared to using only the web UI.

Common Errors

"The website encountered an unexpected error" during install — check PHP error logs; often a missing PHP extension or insufficient permissions on the sites/default/files directory.

Clean URLs not working — verify the Nginx try_files directive is correctly configured to route through index.php.

Continue Reading

Browse more articles in CMS Platforms Beyond WordPress.

  • drupal installation, drupal vps, drupal setup, drupal composer
  • 0 Benutzer fanden dies hilfreich
War diese Antwort hilfreich?

Verwandte Artikel

How to Install Joomla on a VPS

Joomla is a mature, feature-rich open-source CMS offering a middle ground between WordPress's...

How to Install Craft CMS on a VPS

Craft CMS is a developer-friendly, content-first CMS known for its flexible content modeling and...

How to Install TYPO3 on a VPS

TYPO3 is an enterprise-grade CMS widely used in Europe for large, complex websites needing...

How to Install Grav (Flat-File CMS) on a VPS

Grav is a modern, flat-file CMS — it stores content as files rather than in a database,...

How to Install Concrete CMS on a VPS

Concrete CMS (formerly concrete5) is known for its intuitive in-context editing experience...