Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday 10 December 2016

Install & Configure Drupal 7 with MongoDB on CentOS/RHEL 6x

Install & Configure Drupal 7 with MongoDB on CentOS/RHEL 6x


Q. What is Drupal?

-- Drupal is content management software. The application includes a content management platform and a development framework. It's used to make many of the websites and applications you use every day. Drupal has great standard features, like easy content authoring, reliable performance, and excellent security.

Step: 1. Bind Hosts File :

# vi /etc/hosts

10.100.99.214           drupal.domain.com    drupal

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Firewall :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Install NTP Server (for Time Syncronization) :

# yum -y install ntp
# service ntpd restart
# chkconfig ntpd on
# ntpdate pool.ntp.org

Step: 4. Install Apache Server :

# yum -y install httpd httpd-devel

Step: 5. Install PHP 5.6 :

# yum -y install epel-release
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum -y install php56w php56w-cli php56w-devel php56w-common php56w-mbstring \
    php56w-gd php56w-xml php56w-mcrypt php56w-mysqlnd php56w-imap php56w-pdo \
    php56w-snmp php56w-soap php56w-xmlrpc php56w-opcache php56w-iconv \
    php56w-ldap php56w-pear mod_ssl wget

Step: 6. Install MySQL Server 5.6 :

# rpm -Uvh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# yum -y install mysql mysql-server

Step: 7. Finally Restart the Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 8. Start MySQL Service & Set Root Password :

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 9. Create Database for Drupal :

# mysql -u root -p
Enter Password:

mysql> create database drupaldb;
mysql> grant all privileges on drupaldb.* to drupal@localhost identified by 'password';
mysql> grant all privileges on drupaldb.* to drupal@'%' identified by 'password';
mysql> flush privileges;
mysql> exit

Step: 10. Download & Extract Drupal Source Code :

# cd /var/www/html/
# wget http://ftp.drupal.org/files/projects/drupal-7.50.tar.gz
# tar -zxvf drupal-7.50.tar.gz
# mv drupal-7.50 drupal
# chown -Rf apache:apache /var/www/html/drupal

Step: 11. We need to Create Settings file from the default.settings.php File :

# cd /var/www/html/drupal/sites/default/
# cp -p default.settings.php settings.php
# chmod a+w /var/www/html/drupal/sites/default/settings.php
# chmod a+w /var/www/html/drupal/sites/default/

Step: 12. Enable Apache mod_rewrite Module & Set Date-Time In php.ini :

# vi /etc/httpd/conf/httpd.conf

Line No: 338

AllowOverride None To AllowOverride All

At the End, Add this Line :

RewriteEngine on

-- Save & Quit (:wq)

# vi /etc/php.ini

date.timezone = "Asia/Kolkata"

-- Save & Quit (:wq)

# service httpd restart

Step: 13. Install Drupal Through Web Browser :

http://10.100.99.214/drupal/core/install.php

-- Choose Profile: Standard & Clcik on "Save & Continue"
-- Choose Language: English & Click on "Save & Continue"
-- Database Configuration:
     Database Type: Select "MySQL, MariaDB, Percona Server, or equivalent"
     Database Name: drupaldb
     Database Username: drupal
     Database Password: password
  
-- Clcik on "Save & Continue".
-- SITE INFORMATION:
     Site Name: drupal.domain.com
     Site Email Address: koushik@domain.com
-- SITE MAINTENANCE ACCOUNT:
     Username: admin
     Password: Passw0rd
     Confirm Password: Passw0rd
-- REGIONAL SETTINGS:
     Default Country: India
-- Click on "Save & Continue"
-- Click on "View Your New Site."

Step: 14. Install & Configure MongoDB :

# vi /etc/yum.repos.d/mongodb.repo

[mongodb]
name=MongoDB Repo
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

-- Save & Quit (:wq)

# yum -y install mongo-10gen mongo-10gen-server

# vi /etc/mongod.conf

## Change Line Number 19 "bind_ip"

bind_ip=0.0.0.0

-- Save & Quit (:wq)

# service mongod restart
# chkconfig mongod on

Step: 15. Install MongoDB Driver :

# yum -y install gcc openssl-devel
# pecl install mongo

Build with Cyrus SASL (MongoDB Enterprise Authentication) support? [no] : Just Press Enter.

Step: 16. Add the Extension in php.ini File :

# vi /etc/php.d/mongo.ini

extension=mongo.so

-- Save & Quit (:wq)

Step: 17. Finally Restart the Apache Service & Verify :

# service httpd restart

# php -i | grep mongo

Step: 18. Install MongoDB Module in Drupal :

# cd /opt
# wget http://ftp.drupal.org/files/projects/mongodb-7.x-1.x-dev.tar.gz
# tar -zxvf mongodb-7.x-1.x-dev.tar.gz
# mv mongodb /var/www/html/drupal/sites/all/modules/
# chown -Rf apache:apache /var/www/html/drupal/sites/all/modules/mongodb
# cd /var/www/html/drupal/sites/default
# vi local.settings.php

<?php
# MongoDB
$conf['mongodb_connections'] = array(
     'default' => array(
       'host' => 'localhost',                   
       'db' => 'drupal', // Database name. Mongodb will automatically create the database.
       'connection_options' => array( 'replicaSet' => 'my_mongodb_0' ),
      ),
   );

include_once('./includes/cache.inc');

   # -- Configure Cache
   $conf['cache_backends'][] = 'sites/all/modules/mongodb/mongodb_cache/mongodb_cache.inc';
   $conf['cache_class_cache'] = 'DrupalMongoDBCache';
   $conf['cache_class_cache_bootstrap'] = 'DrupalMongoDBCache';
   $conf['cache_default_class'] = 'DrupalMongoDBCache';

   # -- Don't touch SQL if in Cache
   $conf['page_cache_without_database'] = TRUE;
   $conf['page_cache_invoke_hooks'] = FALSE;

   # Session Caching
   $conf['session_inc'] = 'sites/all/modules/mongodb/mongodb_session/mongodb_session.inc';
   $conf['cache_session'] = 'DrupalMongoDBCache';

   # Field Storage
   $conf['field_storage_default'] = 'mongodb_field_storage';

   # Message Queue
   $conf['queue_default_class'] = 'MongoDBQueue';
?>

-- Save & Quit (:wq)

# chown apache:apache local.settings.php
# chmod 644 local.settings.php

# sed -i 's|localhost|10.100.99.214|g' /var/www/html/drupal/sites/all/modules/mongodb/mongodb.module
# sed -i 's|localhost|10.100.99.214|g' /var/www/html/drupal/sites/all/modules/mongodb/mongodb.drush.inc

http://10.100.99.214/drupal/admin/modules

Note: Now Open the Admin Panel of Drupal & Uncheck the "Block" & "Dashboard" from the Modules & Check all the Modules of MongoDB Section except "MongoDB Cache" & "MongoDB Migrate".

-- Click on "Save Configuration."

# mongo
mongo> show dbs
admin   (empty)
drupal  0.078GB
local   0.078GB

mongo> use drupal
mongo> show collections

session
system.indexes
watchdog
watchdog_event_3f71fc116d395612bd0b3dd8e022dc09
watchdog_event_782ddf217853242a4f40f642a4792b9e
watchdog_event_d29d18b2c99dc1af6e22838feee53c62

mongo> exit

** That mean the MongoDB has been Successfully Integrated with the Drupal.

Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog


0 comments:

Post a Comment

Copyright © 2016 Kousik Chatterjee's Blog