Introduction
Drupal is a free and open-source content management system (CMS) written in PHP. This tutorial will guide you through the process of installing Drupal CMS with Apache on Debian 12.
Prerequisites
Before you begin, ensure you have:
- A Debian 12 server or desktop system
- Root or sudo privileges
- Apache installed on your system. If not installed, you can install it with the following command:
sudo apt update
sudo apt install -y apache2
Step 1: Install PHP and Required Extensions
Install PHP and required extensions for Drupal:
sudo apt install -y php libapache2-mod-php php-mysql php-gd php-xml php-xmlrpc php-curl php-intl php-mbstring php-soap php-zip
Step 2: Install MariaDB
Install MariaDB, a MySQL database server:
sudo apt install -y mariadb-server
Step 3: Secure MariaDB
Run the MySQL secure installation script:
sudo mysql_secure_installation
Step 4: Create a MariaDB Database and User
Log in to the MySQL shell and create a database and user for Drupal:
sudo mysql -u root -p
CREATE DATABASE drupaldb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 5: Download and Extract Drupal
Download the latest version of Drupal from the official website:
wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
Extract the Drupal archive to the Apache document root directory:
sudo tar -zxvf drupal.tar.gz -C /var/www/html/
Step 6: Configure Apache
Create a virtual host configuration file for Drupal:
sudo nano /etc/apache2/sites-available/drupal.conf
Add the following configuration to the file:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/drupal
ServerName your_domain.com
ServerAlias www.your_domain.com
<Directory /var/www/html/drupal>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the Drupal site and Apache rewrite module:
sudo a2ensite drupal.conf
sudo a2enmod rewrite
Restart Apache for the changes to take effect:
sudo systemctl restart apache2
Step 7: Complete the Installation
Open a web browser and navigate to your Drupal installation URL (e.g., http://your_domain.com). Follow the on-screen instructions to complete the installation. Provide the database information, site details, and create an admin account.
Conclusion
Congratulations! You have successfully installed Drupal CMS with Apache on Debian 12. You can now configure