- Log into the Debian device
- Run the following commands in a terminal:
# update repositories and install any available software updates
sudo apt update
sudo apt upgrade -y
# install Apache HTTPD and MySQL
sudo apt-get install apache2 mariadb-server mariadb-client curl
# install PHP components
sudo apt install php php-mysql php-cli php-json php-opcache php-gd php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip
# configure the MySQL database
sudo su
mysql_secure_installation - Press Enter to login as root
- Type Y and press Enter to set a root password, type the password twice to confirm
- Type Y and press Enter to remove anonymous users
- Type Y and press Enter to disallow root login remotely
- Type Y and press Enter to remove the test database
- Type Y and press Enter to reload privilege tables
- Run the following command to login into MySQL:
mysql -u root -p
- Authenticate with the root password set earlier
- Run the following commands to create the Drupal database and database user
CREATE DATABASE drupal DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON drupal.* TO 'drupal_rw'@'localhost' IDENTIFIED BY 'Dru4@l!!';
FLUSH PRIVILEGES;
EXIT;
exit - Continue with the following commands to download and extract Drupal in the Apache webroot
# download latest drupal version
sudo wget -O drupal.tar.gz https://www.drupal.org/download-latest/tar.gz
# extract drupal.tar.gz
sudo tar xzvf drupal.tar.gz --directory /var/www
# rename drupal folder
sudo mv /var/www/drupal* /var/www/drupal
# create a new drupal.conf file to configure the site
sudo nano /etc/apache2/sites-available/drupal.conf - Paste the following configuration into drupal.conf
Alias /drupal "/var/www/drupal/"
<Directory /var/www/drupal/>
AllowOverride All
</Directory> - Press CTRL+O, Enter, CTRL+X to write the changes to drupal.conf
- Continue with the following commands to enable the site and restart Apache:
# enable the Drupal site and required PHP modules
sudo a2ensite drupal
sudo a2enmod rewrite
# set the owner of the new drupal directory to www-data
sudo chown -R www-data:www-data /var/www/drupal
# restart apache2 service
sudo systemctl restart apache2 - Open a web browser and navigate to http://DNSorIP/drupal
- The Drupal setup screen should be displayed
- Select a language > Click Save and continue
- Select the Standard profile > Click Save and continue
- Enter the database name, username and password > Click Save and continue
- Create a site title and Drupal login > Click Install Drupal
- When the installation completes, enter a site name, email address, username and password > Click Save and continue
- Welcome to your very own, self-hosted Drupal installation