This guide covers the installation of Drupal Core via the command line using Composer. It details two methods: a Quick Start (using SQLite) and a Standard Installation (using MySQL/MariaDB with Drush).
1. Download Drupal Core
First, secure shell (SSH) into your server and navigate to your desired root directory. Run the following Composer command to download the recommended Drupal project structure:
composer create-project drupal/recommended-project drupal2. Choose Installation Method
Option A: Quick-Start (SQLite)
Best for development environments or testing.
This method uses SQLite 3.45+. Ensure your server meets this requirement (e.g., Ubuntu 24.04 or newer). You must also install the PHP SQLite module.
1. Install the prerequisite module:
sudo apt install php-sqlite32. Run the Quick Start command: Navigate into the directory and run the built-in quick start script. Note the memory limit flag to ensure the process runs smoothly.
cd drupal
php -d memory_limit=256M web/core/scripts/drupal quick-start standardOption B: Standard Install (MySQL/MariaDB via Drush)
Best for production environments.
1. Prepare the Database: Log in to your database server (MySQL or MariaDB) and create a new database and user. Run the following SQL commands:
CREATE DATABASE db_name;
CREATE USER 'db_user'@'localhost' IDENTIFIED BY 'db_password';
GRANT ALL PRIVILEGES ON db_name.* TO 'db_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;2. Install Drush: Drush (Drupal Shell) is a command-line utility that simplifies the installation process.
composer require drush/drush3. Run the Installation: Navigate to the drupal folder and execute the site installation command.
Note: Replace the variables db_user, db_password, db_name, site-name, site-mail, and admin credentials with your specific details. The account-name created here will be User 1 (the Super Admin).
cd drupal
vendor/bin/drush site:install standard \
--db-url=mysql://db_user:db_password@localhost/db_name \
--site-name="My Drupal Site" \
--site-mail="[email protected]" \
--account-name="admin" \
--account-pass="admin_password" \
--yes3. Final Configuration: Web Server
For the site to load correctly in a browser, you must update your web server configuration (Apache or Nginx).
- Action: Change the Document Root in your server configuration to point to the web subdirectory inside your installation folder.
- Path:
.../root-directory/drupal/web
Once updated, restart your web server, and your Drupal site should be live.