How to Install Drupal Ubuntu Servers

This brief tutorial shows students and new users how to install Drupal CMS on Ubuntu servers.

Our lesson 45 tutorial shows students and new users how to install Drupal Content Management System (CMS) on Ubuntu servers.

As you may already know, Drupal is a popular CMS used by many and some of the largest blogs and websites online. I think if you ask any webmaster to name the popular CMSs today, WordPress will come in #1 followed by Drupal not very far behind.

So, Drupal is very popular as well. If WordPress isn’t meeting your needs, try Drupal instead. You might just find what’s missing with WordPress in Drupal.

Step 1: Prerequisites

Before you can use Drupal CMS, you must first install the LAMP stack. The LAMP stack is a collection of open source software that powers most of the PHP based applications and websites online

To install the LAMP stack, read the post below.

Step 2: Create Drupal Database and User

After installing the LAMP stack above, your next task will be to create a database and database user for Drupal. To do that, logon to MySQL server by running the commands below.

mysql -u root -p

After logging in, run the sql statement below to create a database called drupal.


Next, run the statement below to create a database user called drupaluser and provide a password for the user.

CREATE USER drupaluser@localhost IDENTIFIED BY 'password_here';

Now that the database and user are created, give the user rights to manage the database. You can do that by running the commands below.

GRANT ALL ON drupal.* TO drupaluser@localhost;

After that, run the commands below to flush the permission to disk and apply changes made above


Step 3: Installing More PHP Modules

After creating a database and user for Drupal, your next step will be to install more PHP modules that help support Drupal. Run the commands below to do that.

sudo apt update 
sudo apt-get install php-xml php-mysql php-curl php-gd php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc

Step 4: Download Drupal Files

At this point, you should have the LAMP stack installed, MySQL database created with its user and all necessary PHP modules installed.

Your next task is to download Drupal files from online. To do that, run the commands below.

cd /tmp && wget

Change the version number if newer ones are available. Next, run the command below to extract the downloaded file.

tar xzvf drupal*

Then, move Drupal content to Apache default root directory. The default root directory is at /var/www/html.

sudo mv drupal-8.1.10/* /var/www/html

Next, create a setting.php file by copying the default.settings.php file.

cp /var/www/html/sites/default/default.settings.php /var/www/html/sites/default/settings.php

One thing you might want to do is remove Apache2 default html test file. To do that, run the commands below:

sudo rm /var/www/html/index.html

Next, change the file permission and ownership of the root directory.

sudo chmod -R 755 /var/www/html/*
sudo chown -R www-data:www-data /var/www/html/*

After that, enable Apache2 mod_rewrite by running the command below:

sudo a2enmod rewrite

Finally, open Apache2 default config file and make the highlighted changes below, then save the file.

sudo nano /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>

  ServerAdmin [email protected]
  DocumentRoot /var/www/html

  <Directory /var/www/html>
      RewriteEngine on
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


Restart Apache2.

sudo systemctl restart apache2

Then open your browser and browse to the server IP or hostname. When you browse there you should see Drupal setup page.

drupal setup page

Click the Save and continue.

drupal setup page ubuntu

Select the Standard setup and continue.


Type the database name, user and password. Then save and continue until you’re done with the setup.

Thanks for reading and hope you come back soon.

You may also like the post blow:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.