Installing Drupal on localhost
Install the Drupal CMS in local environments like XAMPP or WAMP, and access the development site at http://localhost/drupal.
Drupal is a powerful open-source CMS suitable for enterprise sites, communities, and complex content structures. Installing Drupal on localhost allows for local development of themes, modules, and content types.
Prerequisites
- PHP 8.x (depending on Drupal version requirements)
- MySQL/MariaDB or PostgreSQL
- Apache (recommended to enable
mod_rewrite) or Nginx - Composer (recommended for Drupal 9+)
Installation Steps
1. Create Database
In phpMyAdmin (http://localhost/phpmyadmin), create a new database, such as drupal_local, with the character set utf8mb4.
2. Download Drupal
Download from drupal.org or use Composer:
composer create-project drupal/recommended-project drupalPlace the project in the web root directory, for example, htdocs/drupal/.
3. Run the Installation Wizard
Access http://localhost/drupal in your browser, and follow the wizard to select the language and configure the database:
| Item | Typical Value |
|---|---|
| Database Type | MySQL/MariaDB |
| Database Name | drupal_local |
| Username | root |
| Password | empty or local password |
| Host | localhost |
4. Complete Site Configuration
Set the site name and admin account. The admin path is typically http://localhost/drupal/admin.
Common Paths
| Path | Description |
|---|---|
/drupal | Site homepage |
/drupal/admin | Admin backend |
/drupal/core/themes | Core themes |
/drupal/modules/custom | Custom modules (recommended location) |
Frequently Asked Questions
Clean URLs / Pseudo-static 404
Apache needs to have mod_rewrite enabled, and there should be a .htaccess in the site root; the virtual host configuration should include AllowOverride All.
Missing PHP Extensions
The Drupal installer will check for gd, mbstring, xml, etc. Enable them in php.ini as prompted.
Insufficient Memory
For development environments, you may set memory_limit to 256M or higher.
Summary
The typical local access address for Drupal is http://localhost/drupal, requiring PHP + MySQL and URL rewriting support, making it suitable for medium to large CMS project development.