How to Install Drupal on Debian 13
Drupal is a powerful, flexible, and open-source Content Management System (CMS) used to build and manage websites. It’s supported by a large global community and is ideal for personal blogs, corporate websites, and more.
Update the system.
apt update -y
apt upgrade -y
Install sudo if not already installed.
apt install sudo
Output:
root@Debian13Server:~# apt install sudo
The following package was automatically installed and is no longer required:
linux-image-6.12.33+deb13-amd64
Use 'apt autoremove' to remove it.
Installing:
sudo
Summary:
Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 0
Download size: 2,087 kB
Space needed: 6,865 kB / 18.5 GB available
NOTE:
sudoallows users to run commands with elevated privileges. It's recommended for non-root users.
Install LAMP Stack (Apache + MariaDB + PHP 8.4)
sudo apt install -y apache2 mariadb-server mariadb-client \
php php-cli php-fpm php-common php-mysql \
php-zip php-gd php-intl php-mbstring php-curl \
php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc libapache2-mod-php
Output:
root@Debian13Server:~# sudo apt install -y apache2 mariadb-server mariadb-client php php-cli php-fpm php-common php-mysql php-zip php-gd php-intl php-mbstring php-curl php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc libapache2-mod-php
Installing:
apache2 mariadb-server php-cli php-fpm php-mbstring php-soap php-xmlrpc
libapache2-mod-php php php-common php-gd php-mysql php-tidy php-zip
mariadb-client php-bcmath php-curl php-intl php-pear php-xml
Installing dependencies:
apache2-bin libfcgi0t64 libnghttp3-9 mariadb-plugin-provider-lzma
apache2-data libfontconfig1 libonig5 mariadb-plugin-provider-lzo
apache2-utils libgav1-1 libpcre2-posix3 mariadb-plugin-provider-snappy
fontconfig-config libgd3 librav1e0.7 mariadb-server-core
fonts-dejavu-core libgomp1 librtmp1 mysql-common
fonts-dejavu-mono libheif-plugin-aomenc libsasl2-2 php8.4
galera-4 libheif-plugin-dav1d libsasl2-modules php8.4-bcmath
libabsl20240722 libheif-plugin-libde265 libsasl2-modules-db php8.4-cli
libaom3 libheif-plugin-x265 libsharpyuv0 php8.4-common
libapache2-mod-php8.4 libheif1 libsnappy1v5 php8.4-curl
libapr1t64 libhtml-parser-perl libsodium23 php8.4-fpm
libaprutil1-dbd-sqlite3 libhtml-tagset-perl libssh2-1t64 php8.4-gd
libaprutil1-ldap libhtml-template-perl libsvtav1enc2 php8.4-intl
libaprutil1t64 libhttp-date-perl libterm-readkey-perl php8.4-mbstring
libargon2-1 libhttp-message-perl libtidy58 php8.4-mysql
libavif16 libicu76 libtiff6 php8.4-opcache
libcgi-fast-perl libimagequant0 libtimedate-perl php8.4-readline
libcgi-pm-perl libio-compress-brotli-perl liburi-perl php8.4-soap
libclone-perl libio-html-perl libwebp7 php8.4-tidy
libconfig-inifiles-perl libjbig0 libx265-215 php8.4-xml
libcurl4t64 libjpeg62-turbo libxmlrpc-epi0t64 php8.4-xmlrpc
libdav1d7 libldap-common libxpm4 php8.4-zip
libdbd-mariadb-perl libldap2 libxslt1.1 pv
libdbi-perl liblerc4 libyuv0 rsync
libde265-0 liblua5.4-0 libzip5 socat
libdeflate0 liblwp-mediatypes-perl mariadb-client-core ssl-cert
libencode-locale-perl liblzo2-2 mariadb-common
libfcgi-bin libmariadb3 mariadb-plugin-provider-bzip2
libfcgi-perl libncurses6 mariadb-plugin-provider-lz4
Suggested packages:
apache2-doc libgd-tools libheif-plugin-svtenc libbusiness-isbn-perl
apache2-suexec-pristine libheif-plugin-ffmpegdec libdata-dump-perl libmime-base32-perl
| apache2-suexec-custom libheif-plugin-jpegdec libipc-sharedcache-perl libregexp-ipv6-perl
ufw libheif-plugin-jpegenc libsasl2-modules-gssapi-mit libwww-perl
www-browser libheif-plugin-j2kdec | libsasl2-modules-gssapi-heimdal mailx
libmldbm-perl libheif-plugin-j2kenc libsasl2-modules-ldap mariadb-test
libnet-daemon-perl libheif-plugin-kvazaar libsasl2-modules-otp doc-base
libsql-statement-perl libheif-plugin-rav1e libsasl2-modules-sql python3-braceexpand
Create Drupal Database and User
Login to MariaDB
mysql -u root -p
Then in the MariaDB prompt,
CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'drupal'@'localhost' IDENTIFIED BY 'YourStrongPassword';
GRANT ALL PRIVILEGES ON drupal.* TO 'drupal'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Note: Replace YourStrongPassword with actual StrongPassword
Login to verify:
mysql -u root -p
Download and Extract Drupal
wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
tar -xvf drupal.tar.gz
mv drupal-*/ /var/www/html/drupal
Set correct permissions:
chown -R www-data:www-data /var/www/html/drupal
chmod -R 755 /var/www/html/drupal
Enable Apache Modules & Configure Drupal Virtual Host
Create virtual host config:
vi /etc/apache2/sites-available/drupal.conf
Paste the following configuration (replace domain):
<VirtualHost *:80>
ServerName dev.domainhere.info
ServerAlias www.dev.domainhere.info
ServerAdmin admin@dev.domainhere.info
DocumentRoot /var/www/html/drupal/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/drupal>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
</VirtualHost>
Enable modules and site config:
a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php
a2enmod rewrite
a2ensite drupal.conf
apachectl -t
systemctl restart apache2
Output:
root@Debian13Server:~# a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php
a2enmod rewrite
a2ensite drupal.conf
apachectl -t
systemctl restart apache2
Module mpm_event already disabled
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
ERROR: Module php does not exist!
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2
Enabling site drupal.
To activate the new configuration, you need to run:
systemctl reload apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Final Steps
Access your Drupal site via:
http://dev.domainhere.info
Follow the web installation steps:
- Choose profile
- Set DB:
drupal, user:drupal, password:StrongPassword - Complete setup
You're done!

Done.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS