Drupal is a powerful content management system (CMS) widely used for building websites. In this guide, we will show you how to install Drupal with Apache web server and secure it using a free Let's Encrypt SSL certificate on Ubuntu 24.04. Whether you're setting this up on a Windows VPS UK, VPS UK Windows, or any other UK Windows VPS environment, the steps are easy to follow.
Step 1: Update Your Server
First, ensure your system packages are up to date. SSH into your server (whether it's a local server or a Windows Virtual Private Server Hosting solution) and run the following commands:
sudo apt update && sudo apt upgrade -y
Step 2: Install Apache Web Server
Next, install Apache, the web server that will serve your Drupal site. On your VPS Windows Servers or any Windows Virtual Private Server, use this command:
sudo apt install apache2 -y
Once installed, start and enable Apache to run at boot:
sudo systemctl start apache2 sudo systemctl enable apache2
Step 3: Install PHP and MySQL
Drupal requires both PHP and a database. To install PHP 8.1 and MySQL on your Windows VPS Hosting UK or Ubuntu system, run:
sudo apt install php libapache2-mod-php php-mysql php-xml php-gd php-curl php-zip php-mbstring -y sudo apt install mysql-server -y
After installing MySQL, secure your database server:
sudo mysql_secure_installation
Step 4: Create a MySQL Database for Drupal
Log in to MySQL to create a database and user for Drupal:
sudo mysql -u root -p
Then run the following commands to create the database, user, and grant necessary privileges:
CREATE DATABASE drupal; CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON drupal.* TO 'drupaluser'@'localhost'; FLUSH PRIVILEGES; EXIT;
Step 5: Download and Install Drupal
Go to the /var/www/html
directory and download the latest version of Drupal:
cd /var/www/html sudo wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz sudo tar -xzvf drupal.tar.gz sudo mv drupal-* drupal
Set the proper ownership and permissions for the Drupal directory:
sudo chown -R www-data:www-data /var/www/html/drupal sudo chmod -R 755 /var/www/html/drupal
Step 6: Configure Apache for Drupal
Create a new Apache configuration file for Drupal:
sudo nano /etc/apache2/sites-available/drupal.conf
Add the following configuration:
ServerAdmin admin@example.com DocumentRoot /var/www/html/drupal ServerName your_domain_or_ip AllowOverride All ErrorLog ${APACHE_LOG_DIR}/drupal_error.log CustomLog ${APACHE_LOG_DIR}/drupal_access.log combined
Enable the new site and the Apache rewrite module:
sudo a2ensite drupal.conf sudo a2enmod rewrite sudo systemctl restart apache2
Step 7: Install Let's Encrypt SSL
Now, secure your Drupal site with a free SSL certificate from Let's Encrypt. If you're on a VPS Windows Servers or Windows Virtual Private Servers, the process is the same. First, install Certbot:
sudo apt install certbot python3-certbot-apache -y
Then, run Certbot to install and configure SSL:
sudo certbot --apache
Follow the prompts to complete the SSL setup. Certbot will automatically configure your Apache server to use SSL.
Step 8: Complete Drupal Installation
Finally, complete the Drupal installation through the web interface. Open your browser and navigate to https://your_domain_or_ip
. Follow the on-screen instructions to configure the database and set up your Drupal site.
Conclusion
You’ve successfully installed Drupal CMS with Apache and a free Let's Encrypt SSL certificate on Ubuntu 24.04. Whether you're managing a local server or a Windows VPS UK, VPS UK Windows, or UK Windows VPS, these steps will ensure a secure and functional Drupal site. For reliable Windows Virtual Dedicated Server Hosting solutions, visit Windows VPS UK.