Setting my Own Drupal 7 Blog on VPS

Posted by denutkarsh on Wed, 01/11/2017 - 23:11

It's always nice to have your personal blog where you can post anything you want and with this I setup my first drupal 7 blog. Of course this was also a GCI Task . Setting up my first drupal 7 personal blog was quite a good experience.

Creating a VPS

I had the Github Standard Developer pack which gave me both domain and a vps server. I registered a domain for myself utkarshdixit.me and then I registered my account on Digital Ocean using promo code provided in Github Education Pack. I got 50$ credits for Digital Ocean and then without wasting any time, I created my first droplet which is running on Ubuntu. Also I had added ssh key to this droplet so to use it when installing drupal contrib modules.

Configuring the VPS

Now I decided to install LAMP(Linux, Apache, Mysql, PHP) on my new VPS Server and create a database for my drupal blog.

Installing Apache

sudo apt-get update
sudo apt-get install apache2

Installing Mysql

sudo apt-get install mysql-server php5-mysql
sudo mysql_install_db
sudo mysql_secure_installation

Installing PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo nano /etc/apache2/mods-enabled/dir.conf

The edited dir.conf should look like this

DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

Restarting apache

sudo service apache2 restart

Installing Drupal

After installing LAMP on my server it was now time to install drupal, so I followed the steps below,

Creating Database

I created the mysql database for my drupal blog using simple commands

mysql -u root -p

#After authentication
CREATE DATABASE database_name;
exit

Installing and configuring php.ini

Drupal requires some php modules in order to work. So I used the below commands to install all the required modules for Drupal 7.

sudo apt-get install php5-gd php5-curl libssh2-php

Editing the php.ini to turn off allow_url_fopen

We need to turn off allow_url_fopen for security reasons. Read this, for more information http://stackoverflow.com/questions/127534/should-i-allow-allow-url-fopen-in-php

allow_url_fopen = Off

Enabling Rewrite functionality and Htaccess

By default, Drupal uses and generates URLs for your site's pages that look like "http://www.example.com/?q=node/83". With so-called clean URLs this would be displayed without the "?q=" as "http://www.example.com/node/83". This problem is fixed using Clean Urls in Drupal but Clean Urls requires the htaccess and rewrite functionality to be enabled

sudo a2enmod rewrite
sudo nano /etc/apache2/sites-enabled/000-default.conf

After editing 000-default.conf looked like this

Restart the service

sudo service apache2 restart

Downloading Drupal

Our Server is now configured to run Drupal 7 so now let's download and extract it.

cd /var/www/html
sudo wget https://ftp.drupal.org/files/projects/drupal-7.53.tar.gz
tar xzvf drupal-7.53.tar.gz
sudo mv drupal-7.53 blog

Adjusting Drupal Files

We need to adjust some Drupal files like default.settings.php so that installer can install drupal. So i followed the below commands

mkdir blog/sites/default/files
cp blog/sites/default/default.settings.php blog/sites/default/settings.php
chmod 777 /sites/default/settings.php

Run the Installer

Now I just ran drupal installer by going to utkarshdixit.me/blog. I filled all the configuration form and then drupal was installed on this server

Theme

I found out Bootstrap Clean Blog theme for drupal 7 and enabled it. It was one of the best themes that I have ever seen, so there was no doubt in making it my drupal 7 default theme

Modules

I have installed the modules below:-

  1. Boost
  2. Advanced CSS/JS Aggregation
  3. PathAuto
  4. Token
  5. CTools

Why didn't I choose Wordpress for it?

My brother's has a blog built on Wordpress and I thought of comparing it to my drupal blog and I was stunned with the results. My drupal blog is almost 5 times faster with respect to his Wordpress blog.

Drupal

Wordpress

I think there is no need to explain anything after having a look at above images. I am glad that my blog is 15 times more faster than his blog. I have asked my brother to move to drupal too.

Resources followed

The only thing i miss in drupal 7 is that I am unable to use my Social Auth Twitter here.