Install DRUPAL & create your own Website/Blog
Drupal is a free and open source content management system. Drupal aka Drupal core can server as a website, a single or multi-user blog, or even can be used as a forum. Drupal offer a sophisticated API for developers but its basic website installation & administration requires no programming knowledge.
Drupal can run on any operating system that supports a web server with PHP & a database. So Drupal can be installed on Windows machine, Linux or Mac OS. Drupal provides a number of featured like user account registration and maintenance, menu management, RSS feeds, taxonomy, page layout customization etc.
In this tutorial, we will learn to install Drupal 8.4.0 on Linux machines. So let’s start with pre-requisites..
(Recommended Read: WordPress Installation on CentOS/RHEL)
(Also Read: Create your website with Joomla)
-> Drupal requires LAMP installed on systems, so we should have one ready. We have already covered LAMP installation on CentOS/RHEL & Ubuntu, so refer to these articles to install LAMP server (Install PHP from the below mentioned tutorial).
-> PHP 7 is required. If you are using older version of PHP i.e. 5XXX, than you need to install/upgrade the PHP to php 7. Install the php 7, run the following command to install php 7 onto your system,
$ sudo yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-14.ius.centos7.noarch.rpm
$ sudo yum -y install php70u php70u-pdo php70u-mysqlnd php70u-opcache php70u-xml php70u-mcrypt php70u-gd php70u-devel php70u-intl php70u-mbstring php70u-bcmath php70u-json php70u-iconv
Also go through the detailed tutorial to upgrade the php on your machine.
Once we have our LAMP server ready, we can start he installation of Drupal. We will first grab latest version of Drupal, which at the time of writing this article is 8.4.0. Use the following command to download the tar package,
$ wget https://ftp.drupal.org/files/projects/drupal-8.4.0.tar.gz
Now extract the package,
$ tar -xvf drupal-8.4.0.tar.gz
& copy all its content to ‘var/www/html/’,
$ cd drupal-8.4.0
$ mv * /var/www/html
Next we will create a database for Drupal to use, to store the data on. Login to MySql & create the database,
$ mysql -u root -p -e “CREATE DATABASE drupaldb CHARACTER SET utf8 COLLATE utf8_general_ci”
Next create a user for accessing ‘drupaldb’;
$ mysql -u root -p
mysql> create user drupaluser@localhost identified by ‘drupalpasswd’;
Now grant privileges to the user,
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupaldb.* TO ‘drupaluser’@’localhost’ IDENTIFIED BY ‘drupalpasswd’;
Now, implement the changes made to db with following command;
mysql> flush privileges;
than exit the database,
We now have our DB & DB user ready. Same process is to be done, if using MariaDB instead of MySql server.
Now we will make some changes to apache server. We will enable rewrite functionality for the web server as this will allow Drupal to modify URLs to human friendly strings. Enable mod_rewrite in CentOS machines by adding following line to httpd.conf,
$ vim /etc/httpd/conf/httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
For Ubuntu machines, open terminal & run the following command to enable mod_rewrite,
$ sudo a2enmod rewrite
Next we will allow the use of .htaccess file for Drupal installation. Open the file where you have mentioned the virtual host entries, it can be one of the following files,
/etc/httpd/conf/httpd.conf (for Centos)
/etc/apache2/apache2.conf (for Ubuntu)
or it can be custom host config file like
Make the following entry to the file you are using to define virtual hosts,
For Apache 2.2
For Apache 2.4
Require all granted
Now save the file & exit. Next restart the service to implement the changes.
$ service apache2 restart (For Ubuntu)
$ service httpd restart (For CentOS)
We will start the Drupal installation, but first copy the default settings file and rename the duplicate. Do not rename the default file as we require both files for the Drupal installation.
$ cd /var/www/html/sites/default
$ cp default.settings.php settings.php
$ cp default.services.yml services.yml
Now modiy the permissions of the file, so that it has writer permssions,
$ chmod 666 settings.php services.yml
We also need to create a folder named ‘files’ in the same directoru i.e. /var/www/html/sites/default/
$ mkdir files
Now, open the web-browser & enter the following URL to start the Drupal installation,
Setup will start as soon as the page is loaded, follow the on screen steps to install Drupal. On the first screen, we need to select the language & continue,
On the next screen, select the profile. We are using the default profile i.e. standard,
On this screen, setup will review the requirements & will provide the errors or warnings that are needed to resolved to proceed with the setup,
Resolve any error & click continue to move further. On the next screen, we need to enter the database details,
Upon pressing ‘Save and continue’, installation will now start,
After the installation has been completed, we will be directed to configuration screen. Make the configurations as needed & proceed further,
Congratulations, we have now configured our website with Drupal.
This was our tutorial on how to install Drupal to create your own website/blog. Please do mention your queries or suggestions using the comment box below.