Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday 13 May 2017

How To Configure CodeIgniter PHP Framework on CentOS/RHEL 6x

How To Configure CodeIgniter PHP Framework on CentOS/RHEL 6x


What is CodeIgniter ?

-- CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

Step: 1. Set Host Name :

# hostname mysite.domain.com
# vi /etc/sysconfig/network

HOSTNAME=mysite.domain.com

-- Save & Quit (:wq)

Step: 2. Bind Host File :

# vi /etc/hosts

10.100.97.38    mysite.domain.com        mysite

-- Save & Quit (:wq)

Step: 3. Stop Firewall & Disable Selinux :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 4. Install NTP Server For Time Synchronization :

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

Step: 5. Reboot the System :

# init 6

Step: 6. Install EPEL & Remi Repository :

# yum -y install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Step: 7. Install Apache Server :


# yum -y install --enablerepo=remi,epel httpd httpd-devel mod_ssl

Step: 8. Remove MySQL 5.1 & Install MySQL 5.6 :

# yum -y remove mysql mysql-*

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

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

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 10. Install PHP 5.6 :

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum -y install php56w php56w-common php56w-cli php56w-devel php56w-gd \
    php56w-mysql php56w-mcrypt php56w-mbstring php56w-imap php56w-snmp \
    php56w-xml php56w-xmlrpc php56w-ldap php56w-pdo php56w-json php56w-dom \
    wget unzip curl git openssl
 
Step: 11. Create Database for CodeIgniter :

# mysql -u root -p
Enter Password: redhat

MySQL> create database codedb;
MySQL> grant all privileges on codedb.* to code@'localhost' identified by 'password';
MySQL> grant all privileges on codedb.* to code@'%' identified by 'password';
MySQL> flush privileges;
MySQL> exit

Step: 12. Install Composer :

Note: Composer is required for installing CodeIgniter Dependencies.

# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer

Step: 13. Download & Install CodeIgniter Code from Git :

# cd /var/www/html
# git clone https://github.com/bcit-ci/CodeIgniter.git mysite
# cd mysite
# composer install
# chown -Rf apache:apache /var/www/html/mysite
# chmod -Rf 775 /var/www/html/mysite

Step: 14. Set Base URL & Database Connection :

# vi /var/www/html/mysite/application/config/config.php

$config['base_url'] = 'http://mysite.domain.com';

-- Save & Quit (:wq)

# vi /var/www/html/mysite/application/config/database.php

$db['default'] = array(
        'dsn'   => '',
        'hostname' => 'localhost',
        'username' => 'code',
        'password' => 'password',
        'database' => 'codedb',
        'dbdriver' => 'mysqli',
       
-- Save & Quit (:wq)

Step: 15. Create Apache Virtual Host :


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

-- Add these Lines at Line no 313 :

<Directory /var/www/html/mysite>
     Options  -Indexes +Multiviews +FollowSymLinks
        DirectoryIndex index.php index.html
     AllowOverride All
     Allow from all
</Directory>

-- Uncomment Line 996 :

NameVirtualHost *:80

-- Add this Line at the End of the File :

RewriteEngine on

-- Save & Quit (:wq)

# vi /etc/httpd/conf.d/10.100.97.38.conf

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin techsupport@domain.com
  ServerName 10.100.97.38


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/10.100.97.38-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/10.100.97.38-access_log combined Env=!DontLog

</VirtualHost>

-- Save & Quit (:wq)

# vi /etc/httpd/conf.d/mysite.domain.com.conf

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin techsupport@domain.com
  ServerName mysite.domain.com
  ServerAlias www.mysite.domain.com


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html/mysite


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/mysite.domain.com-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/mysite.domain.com-access_log combined Env=!DontLog

</VirtualHost>

-- Save & Quit (:wq)

# mkdir /logs

Step: 16. Start Apache Server :


# service httpd restart
# chkconfig httpd on

http://mysite.domain.com

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

 

Saturday 22 April 2017

How To Configure Laravel PHP Framework on CentOS/RHEL 6x

How To Configure Laravel PHP Framework on CentOS/RHEL 6x


What is Laravel PHP Framework ?

-- Laravel is a free, open-source PHP Web Framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern.

Installation Step :

Step: 1. Set Host Name :

# hostname laravel.oit.com
# vi /etc/sysconfig/network

HOSTNAME=laravel.oit.com

-- Save & Quit (:wq)

Step: 2. Bind Host File :

# vi /etc/hosts

10.100.97.38    laravel.domain.com        laravel

-- Save & Quit (:wq)

Step: 3. Stop Firewall & Disable Selinux :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 4. Install NTP Server For Time Synchronization :

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

Step: 5. Reboot the System :

# init 6

Step: 6. Install EPEL & Remi Repository :

# yum -y install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Step: 7. Install Apache Server :

# yum -y install --enablerepo=remi,epel httpd httpd-devel

Step: 8. Remove MySQL 5.1 & Install MySQL 5.6 :

# yum -y remove mysql mysql-*

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

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

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 10. Install PHP 5.6 :

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# yum -y install php56w php56w-common php56w-cli php56w-devel php56w-gd \
    php56w-mysql php56w-mcrypt php56w-mbstring php56w-imap php56w-snmp \
    php56w-xml php56w-xmlrpc php56w-ldap php56w-pdo php56w-json php56w-dom \
    wget unzip curl git openssl

Step: 11. Install Composer :

Note: Composer is required for installing Laravel Dependencies.

# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer

Step: 12. Install Laravel Framework :

Note: To download latest version of Laravel, Use below command to clone master repo of laravel
               from github.

# cd /var/www/html
# git clone https://github.com/laravel/laravel.git
# cd /var/www/html/laravel
# composer install
# chown -Rf apache.apache /var/www/html/laravel
# chmod -Rf 755 /var/www/html/laravel

Step: 13. Set Encryption Key :

-- Now set the 32 bit long random number encryption key, which used by the Illuminate
      encryption service.

# cd /var/www/html/laravel
# mv .env.example .env
# chown -Rf apache.apache /var/www/html/laravel
# php artisan key:generate

[OUTPUT]
Application key [base64:lNOx1cxl0JWAWX56/Ql6o7/mcw7AVairy1Uqs2XplFo=] set successfully.

-- Update the above Generated Application key into the config/app.php configuration file.
     Also make sure that cipher is set properly.

# vi /var/www/html/laravel/config/app.php

'key' => env('APP_KEY', 'base64:IZ+g3FU+OF1nO4j/4y4EHDdUq4gyJZcJ+weClk3B5Qo='),
'cipher' => 'AES-256-CBC',

-- Save & Quit (:wq)

Step: 14. Create Apache Virtual Host :

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

-- Add these Lines at Line no 313 :

<Directory /var/www/html/laravel/public>
     Options  -Indexes +Multiviews +FollowSymLinks
        DirectoryIndex index.php index.html
     AllowOverride All
     Allow from all
</Directory>

-- Uncomment Line 996 :

NameVirtualHost *:80

-- Add this Line at the End of the File :

RewriteEngine on

-- Save & Quit (:wq)

# vi /etc/httpd/conf.d/10.100.97.38.conf

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin techsupport@domain.com
  ServerName 10.100.97.38


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/10.100.97.38-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/10.100.97.38-access_log combined Env=!DontLog

</VirtualHost>

-- Save & Quit (:wq)

# vi /etc/httpd/conf.d/laravel.domain.com.conf

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin techsupport@domain.com
  ServerName laravel.domain.com
  ServerAlias www.laravel.domain.com


  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.php
  DocumentRoot /var/www/html/laravel/public


  # Custom log file locations
  LogLevel warn
  ErrorLog  /logs/laravel.domain.com-error_log
  SetEnvIf Request_URI "\.(jpg|xml|png|gif|ico|js|css|swf|js?.|css?.)$" DontLog
  CustomLog /logs/laravel.domain.com-access_log combined Env=!DontLog

</VirtualHost>

-- Save & Quit (:wq)

# mkdir /logs

Step: 15. Start Apache Server :

# service httpd restart
# chkconfig httpd on

http://laravel.domain.com


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

 

Sunday 9 April 2017

How To Configure Revive AD Server on CentOS/RHEL 6x

How To Configure Revive AD Server on CentOS/RHEL 6x



What is OpenX Ad Server?

-- OpenX Ad Server is an ad server, created and published by the British-American company OpenX.org. It is a system that can be used to manage and optimize the advertising space on one or more websites. It is a tool for web site owners (called ‘publishers’ in the online advertising industry) but also for organizations running their own ad network. It can even be used by advertisers to manage and measure the ads that they display on their distribution of sites and/or ad networks.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.97.40    ad.domain.com     ad

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Iptables (This Is For On CentOS/RHEL Server) :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Rebbot the System :

# init 6

Step: 4. Install Apache Server :


# yum -y install httpd httpd-devel wget

Step: 5. Edit httpd.conf file :

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

#ServerName www.example.com:80

-- Add this Line:

ServerName ip_address_of_server:80

-- Save & Quit (:wq)

Step: 6. Download & Extract Ad Server Package :
 
# cd /var/www/html
# wget http://download.revive-adserver.com/revive-adserver-3.0.2.zip
# unzip revive-adserver-3.0.2.zip
# mv revive-adserver-3.0.2 adserver
# chmod -Rf 775 adserver

Step: 7. Edit the /etc/httpd/conf/httpd.conf File :

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

Add those Lines :

<Directory /var/www/html/adserver>
    Options -Indexes +Multiviews
       DirectoryIndex index.php index.html
    AllowOverride All
    Allow from all
</Directory>

-- Save & Quit (:wq)

Step: 8. Install MySQL Database Server :

# yum -y install mysql mysql-server

Step: 9. Start Mysqld Service & Set MySQL Root Password :

# service mysqld start
# chkconfig mysqld on

# mysql_secure_installation

-- Press "Enter".
-- Type "Y" & Press "Enter".
-- Give the Root Password & Press "Enter".
-- Type "Y" & Press "Enter".
-- Type "N" & Press "Enter".
-- Type "Y" & Press "Enter".
-- Type "Y" & Press "Enter".

Step: 10. Create Database for Openx :

# mysql -u root -p
Give root Password: redhat

Mysql> create database revivedb character set utf8;
Mysql> grant all privileges on revivedb.* to 'revive'@'localhost' identified by '0p3nx123';
Mysql> flush privileges;
Mysql> exit

Step: 11. Install EPEL Repository :

# yum -y install epel-release

Step: 12. Install PHP5 Scripting Language :

# yum -y install php php-mysql php-common php-cli php-gd php-mbstring php-mcrypt \
    php-devel php-xml php-xmlrpc

Step: 13. Create a file Under "html" Directory for Testing php :

# vi /var/www/html/info.php

<?php
  phpinfo();
?>

-- Save & Quit (:wq)

Step: 14. Restart Apache to load php :

# service httpd restart
# chkconfig httpd on

Step: 15. Then point your Web Browser & Check php :

Ex- http://server_ip_address/info.php

Step: 16. Configure Openx AD Server :

Go to http://server_ip/adserver

-- Check "I Agree".
-- Database Name: revivedb
     Database Username: revive
     Database Password: 0p3nx123
     Database Hostname: localhost
  
-- Click on "Continue".
-- Administrator Username: admin
     Administrator Password: Passw0rd
     Repeat Password: Passw0rd
     Administrator Email Address: kchatterjee@domain.com
     Language: English
     Timezone: GMT+0530 Asia/Culcutta
  
-- Click on "Continue"
-- Click on "Continue".

Step: 17. OpenX Memcached Configuration from Web Interface :

http://Server_ip/adserver/plugin-settings.php?group=oxMemcached

-- Add your memcached server and port if it’s default installation on the same machine add
    localhost:11211 and expiry time of 600 seconds.
-- Click on "Save Changes"

-- Now you need to go in Configuration
-- Banner Delivery Settings and set Time Between Banner Cache Updates to 600 seconds and
     change Banner Delivery Cache Store Type to Memcached.

-- Click on "Save Changes"



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

 

Sunday 2 April 2017

How To Configure SuPHP on CentOS/RHEL 6x

How To Configure SuPHP on CentOS/RHEL 6x


Q. What is SuPHP ?

-- SuPHP is an apache module that allows PHP to under a different Linux user than the apache user. This improves the security of hosted websites as you can run the PHP scripts of each website under a different user.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.97.40    ser4.domain.com     ser4

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Iptables (This Is For On CentOS/RHEL Server) :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Rebbot the System :

# init 6

Step: 4. Install Apache Server :

# yum -y install httpd httpd-devel

Step: 5. Install PHP :

# yum -y install epel-release
# yum -y install php php-cli php-devel php-common php-mbstring php-gd php-xml \
    php-mcrypt php-mysql php-imap php-pdo php-snmp php-soap php-xmlrpc \
    php-opcache php-ldap php-pear php-zip php-curl php-cgi php-fpm wget curl
 
Step: 6. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 7. Install SuPHP & Dependencies :

# yum -y groupinstall 'Development Tools'
# cd /usr/local/src
# wget http://suphp.org/download/suphp-0.7.2.tar.gz
# tar zxvf suphp-0.7.2.tar.gz
# wget -O suphp.patch https://lists.marsching.com/pipermail/suphp/attachments/20130520/74f3ac02/attachment.patch
# patch -Np1 -d suphp-0.7.2 < suphp.patch
# cd suphp-0.7.2
# autoreconf -if
# ./configure --prefix=/usr/ --sysconfdir=/etc/ --with-apr=/usr/bin/apr-1-config \
--with-apache-user=apache --with-setid-mode=owner --with-logfile=/var/log/httpd/suphp_log
# make
# make install

Step: 8. Enabling SuPHP Module in Apache :

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

-- Add This Line in "LoadModule" Section :

LoadModule suphp_module modules/mod_suphp.so

-- Save & Quit (:wq)

Step: 9. Create SuPHP Config File :


# vi /etc/suphp.conf

[global]
;Path to logfile
logfile=/var/log/httpd/suphp.log
;Loglevel
loglevel=info
;User Apache is running as
webserver_user=apache
;Path all scripts have to be in
docroot=/
;Path to chroot() to before executing script
;chroot=/mychroot
; Security options
allow_file_group_writeable=true
allow_file_others_writeable=false
allow_directory_group_writeable=true
allow_directory_others_writeable=false
;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true
;Send minor error messages to browser
errors_to_browser=false
;PATH environment variable
env_path=/bin:/usr/bin
;Umask to set, specify in octal notation
umask=0077
; Minimum UID
min_uid=100
; Minimum GID
min_gid=100

[handlers]
;Handler for php-scripts
x-httpd-suphp="php:/usr/bin/php-cgi"
;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

-- Save & Quit (:wq)

Step: 10. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 11. Configure an Apache Vhost with SuPHP :


# useradd -s /sbin/nologin web1
# mkdir /var/www/html/example.com
# vi /var/www/html/example.com/info.php

<?php
phpinfo();
?>

-- Save & Quit (:wq)

# chown -Rf web1:web1 /var/www/html/example.com
# vi /etc/httpd/conf.d/example.com.conf

<VirtualHost *:80>
 DocumentRoot /var/www/html/example.com
 ServerName example.com
 ServerAlias www.example.com
 ServerAdmin webmaster@example.com

 <FilesMatch ".+\.ph(p[345]?|t|tml)$">
 SetHandler None
 </FilesMatch>

 <IfModule mod_suphp.c>
 suPHP_Engine on
 <FilesMatch "\.php[345]?$">
 SetHandler x-httpd-suphp
 </FilesMatch>
 suPHP_AddHandler x-httpd-suphp
 </IfModule>
</VirtualHost>

-- Save & Quit (:wq)

# service httpd restart

Step: 12. Test the SuPHP Setup :

http://example.com/info.php

Note: Important is the ServerAPI line which shows CGI/FastCGI. which shows that PHP is run through SuPHP & not mod_php.

# vi /var/www/html/example.com/testuser.php

<?php
echo get_current_user();
?>

-- Save & Quit (:wq)

# chown -Rf web1:web1 /var/www/html/example.com/testuser.php

http://example.com/testuser.php


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


Sunday 26 March 2017

Install & Configure Lighttpd with SSL on CentOS/RHEL 6x

Install & Configure Lighttpd with SSL on CentOS/RHEL 6x


Q. What is Lighttpd ?

-- Lighttpd is a Web Server for UNIX/Linux and Windows operating systems. It is an alternative to Apache Web Server. It is also called Lighty. It is designed to be Secure, fast, standards-compliant, and flexible while being optimized for speed-critical environments.

Step: 1. Bind Host File :

# vi /etc/hosts

10.100.97.40    ser4.domain.com     ser4

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Stop Iptables :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Rebbot the System :

# init 6

Step: 4. Install Lighttpd Server :

# yum -y install epel-release
# yum -y install lighttpd openssl

Step: 5. Disable IPv6 Support :

# vi /etc/lighttpd/lighttpd.conf

server.use-ipv6 = "disable"
server.max-fds = 2048

-- Save & Quit (:wq)

Step: 6. Start Lighttpd Server :

# service lighttpd restart
# chkconfig lighttpd on

Step: 7. Create Certificate Signing Request (CSR) :

# mkdir /etc/lighttpd/ssl/
# cd /etc/lighttpd/ssl/

# openssl req -new -newkey rsa:2048 -nodes -keyout ser4.domain.com.key -out ser4.domain.com.csr

Country Name (2 letter code) [XX]: IN
State or Province Name (full name) []: WB
Locality Name (eg, city) [Default City]: Kolkata
Organization Name (eg, company) [Default Company Ltd]: Organization_Name
Organizational Unit Name (eg, section) []: IT
Common Name (eg, your name or your server's hostname) []: ser4.domain.com
Email Address []: admin@domain.com

A challenge password []: Just Press Enter.
An optional company name []: Just Press Enter.

Step: 8. Request Certificate from CA :

# openssl x509 -req -days 365 -in ser4.domain.com.csr -signkey ser4.domain.com.key -out ser4.domain.com.crt
# cat ser4.domain.com.key ser4.domain.com.crt > ser4.domain.com.pem

Step: 9. Lighttpd Virtual Hosting :

# mkdir -p /var/www/domain.com/http
# mkdir /var/log/lighttpd/domain.com
# chown lighttpd:lighttpd /var/www/domain.com/http
# chown lighttpd:lighttpd /var/log/lighttpd/domain.com

# vi /etc/lighttpd/lighttpd.conf

$SERVER["socket"] == ":443" {
        ssl.engine = "enable"
        ssl.pemfile = "/etc/lighttpd/ssl/ser4.domain.com.pem" 
}

$HTTP["host"] =~ "(^|\.)domain\.com$" {
server.name = "ser4.domain.com"
server.document-root = "/var/www/domain.com/http"
accesslog.filename = "/var/log/lighttpd/domain.com/access.log"
server.error-handler-404 = "/e404.php"
}

-- Save & Quit (:wq)

Step: 10. Verify Configuration & Restart Lighttpd :

# lighttpd -t -f /etc/lighttpd/lighttpd.conf
Syntax OK

# service lighttpd restart

# netstat -tulpn | grep lighttpd
tcp        0      0 0.0.0.0:80                    0.0.0.0:*                   LISTEN      3426/lighttpd      
tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      3426/lighttpd



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

 

Saturday 18 March 2017

How To Configure Magento2 with Nginx on Ubuntu 14.04

How To Configure Magento2 with Nginx on Ubuntu 14.04


Q. What is Magento :

-- Magento is an e-commerce platform built on open source technology which provides online merchants with a flexible shopping cart system, as well as control over the look, content and functionality of their online store. Magento offers powerful marketing, search engine optimization, and catalog-management tools.

Step: 1. Set Host Name :

# hostname magento.domain.com
# vi /etc/hostname

magento.domain.com

-- Save & Quit (:wq)

Step: 2. Bind Hosts File :

# vi /etc/hosts

10.100.97.37    magento.domain.com        magento

-- Save & Quit (:wq)

Step: 3. Update the System :

# apt-get update
# apt-get -y upgrade

Step: 4. Install NTP Server For Time Synchronization :

# apt-get -y install ntp ntpdate
# service ntp restart
# ntpdate pool.ntp.org
# date

Step: 5. Install Nginx Server :

# apt-get -y install nginx

-- Verify that Nginx has been Installed Properly by Checking the Port :

# netstat -plntu | grep 80

Step: 6. Install PHP7 with PHP7-FPM :

# apt-get -y install language-pack-en-base
# LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
# apt-get update

# apt-get -y install php7.0 php7.0-fpm php7.0-mcrypt php7.0-curl php7.0-cli php7.0-mysql \
    php7.0-gd php7.0-xsl php7.0-json php7.0-intl php7.0-dev php7.0-common php7.0-mbstring \
    php7.0-zip php-pear php-soap libcurl3 curl wget

Step: 7. Modify PHP Settings For Magento :

# vi /etc/php/7.0/fpm/php.ini

memory_limit = 512M
max_execution_time = 1800
zlib.output_compression = On

-- Save & Quit (:wq)

# vi /etc/php/7.0/cli/php.ini

memory_limit = 512M
max_execution_time = 1800
zlib.output_compression = On

-- Save & Quit (:wq)

Step: 8. Restart the PHP7-FPM Service to Apply the Configuration Changes :
 
# service php7.0-fpm restart

Step: 9. Install MySQL Server :

# apt-get -y install mysql-server-5.6 mysql-client-5.6

New password for the MariaDB "root" user: redhat
Repeat password for the MariaDB "root" user: redhat

Step: 10. Create Database & DB User for Magento :

# mysql -u root -p
Enter the Password:

mysql> create database magentodb;
mysql> grant all privileges on magentodb.* to magento@localhost identified by 'password';
mysql> flush privileges;
mysql> \q

Step: 11. Install PHP Composer :

# cd ~/
# curl -sS https://getcomposer.org/installer | php
# mv composer.phar /usr/bin/composer

-- Now Verify that Composer Command is Working :

# composer -v

Step: 12. Download & Extract Magento 2 :

# mkdir /var/www/
# cd /var/www/
# wget https://github.com/magento/magento2/archive/2.0.7.tar.gz
# tar -zxvf 2.0.7.tar.gz
# mv magento2-2.0.7 magento2

Step: 13. Configure the Magento Key :

At 1st Register A Magento Account. Click on Below Link :

http://repo.magento.com/

-- Create An Account.
-- After Created the Account & Click on "My Account"
-- Click on "Developers"
-- Click on "Secure Keys"
-- Give A Name & Click on "Generate New". (It will Generate Random Public & Private Keys).

Step: 14. Install Third-Party Components for Magento :

# cd /var/www/magento2/
# composer install -v

Authentication required (repo.magento.com):
Username: 65500dc62bc7a48f09c36056df12bf03 (Use Public Key For User Name)
Password: 528d7b92a879cb673f18940322312e10 (Use Private Key For User Password)
     
-- Do you want to store credentials for repo.magento.com in /root/.config/composer/auth.json ?
     [Yn] Type "Y" & Press "Enter"

Step: 15. Configure the Nginx Virtualhost :

# vi /etc/nginx/sites-available/magento

-- Paste the below Configuration :

upstream fastcgi_backend {
        server  unix:/run/php/php7.0-fpm.sock;
}

server {

        listen 80;
        server_name magento.domain.com;
        set $MAGE_ROOT /var/www/magento2;
        set $MAGE_MODE developer;
        include /var/www/magento2/nginx.conf.sample;
}

-- Save & Quit (:wq)

# ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled/
# service nginx restart

Step: 16. Install Magento Through Command Line :

# cd /var/www/magento2
# bin/magento setup:install --backend-frontname="adminlogin" \
--key="65500dc62bc7a48f09c36056df12bf03" \
--db-host="localhost" \
--db-name="magentodb" \
--db-user="magento" \
--db-password="password" \
--language="en_US" \
--currency="INR" \
--timezone="Asia/Kolkata" \
--use-rewrites=1 \
--use-secure=0 \
--base-url="http://magento.domain.com" \
--base-url-secure="https://magento.domain.com" \
--admin-user=admin \
--admin-password=Passw0rd \
--admin-email=admin@domain.com \
--admin-firstname=Koushik \
--admin-lastname=Chatterjee \
--cleanup-database

IMPORTANT Note:

backend-frontname: The admin page for our magento site, we use 'adminlogin'.
Key: Magento Keys, we can generate it, or find it random on http://randomkeygen.com/.
Base-url: Make sure it is same with Virtualhost Configuration.

Step: 17. Set Appropriate Permission for Magento :

# cd /var/www/magento2/
# chmod 700 /var/www/magento2/app/etc
# chown -Rf www-data:www-data .

Step: 18. Restart the Nginx Server :

# service nginx restart

Step: 19. Access the Site & Admin Panel :

http://magento.domain.com

-- For Admin Access :

http://magento.oit.com/adminlogin
User: admin
Pass: Passw0rd

Note: If You get an Error about a Missing Magento indexer Cronjob, then you can Solve it by adding the Following Cronjob to Your Server.

# crontab -u www-data -e

-- Add the Following Lines:

* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log

-- Save & Quit (:wq)

# service cron restart

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


Sunday 5 March 2017

Install & Configure Chamilo (Learning Management System) on CentOS 6x

Install & Configure Chamilo (Learning Management System) on CentOS 6x


Q. What is Chamilo?

-- Chamilo is a  software which is used for virtual/online trainings or Learning Management System. Chamilo is absolutely free and comes under GPL License, with Chamilo you can store and organize all of study materials which can be utilized by tutors and students.

-- Some of the important features of Chamilo are:

1. Course and user management based on various user’s profiles like students, Teachers, Session
     Managers, Administrators.
2. You can Download, upload or hide some course contents as and when required.
3. Create, add , delete questions in the form of multiple choice, fill in the blank, matching type questions or
     open questions.
4. Various types of survey can be conducted with the help of Chamilo.
5. You can enable deadline based assignments.
6. Users can be generated in bulk.
7. CSV/Excel data can bde downloaded or uploaded and Instant results reports can be generated.

Step: 1. Bind Hosts File :

# vi /etc/hosts

192.168.72.220    ser1.domain.com    ser1

-- Save & Quit (:wq)

Step: 2. Disable Selinux & Firewall :


# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 3. Install NTP :

# 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 MySQL Database Server :

# yum -y install mysql mysql-server mysql-devel

Step: 6. Install Epel Repo :

# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Step: 7. Install PHP :

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

# yum -y install php56w php56w-mysql php56w-common php56w-gd php56w-mbstring \
    php56w-mcrypt php56w-devel php56w-xml php56w-imap php56w-ldap php56w-pdo \
    php56w-odbc php56w-pear php56w-xmlrpc php56w-soap php56w-cli mod_ssl \
    libtool-ltdl mhash mcrypt unzip
 
Step: 8. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 9. Set MySQL Root Password :

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 10. Create Database and User for Chamilo :

# mysql -u root -predhat

mysql> create database chamilodb;
mysql> grant all privileges on chamilodb.* TO chamilo@localhost identified by 'password';
mysql> grant all privileges on chamilodb.* TO chamilo@'%' identified by 'password';
mysql> flush privileges;
mysql> exit

Step: 11. Install Some Prerequired Packages :

# yum -y install gcc-c++ libuuid-devel

Step: 12. Modify php.ini :


# vi /etc/php.ini

date.timezone = "Asia/Kolkata"
max_execution_time = 300
max_input_time = 600
memory_limit = 256M
post_max_size = 128M
upload_max_filesize = 128M
session.cookie_httponly = On
extension = xapian.so

-- Save & Quit (:wq)

Step: 13. Enable Internationalization Support in PHP :

# yum -y install libicu libicu-devel.x86_64
# /usr/bin/pecl install intl
# echo 'extension=intl.so' >> /etc/php.ini

Step: 13. Download latest Version of Chamilo :

# cd /var/www/html/
# wget https://github.com/chamilo/chamilo-lms/archive/v1.10.0.zip
# unzip v1.10.0.zip
# rm -rf v1.10.0.zip
# mv chamilo-lms-1.10.0 chamilo
# chmod -Rf 755 /var/www/html/chamilo
# chown -R apache:apache /var/www/html/chamilo

Step: 14. Restart the Apache Service :

# service httpd restart

Step: 15. Install Chamilo Through Web Browser :

http://192.168.72.220/chamilo

-- Click on "Install Chamilo".
-- Select Language & Click Next.
-- Scroll Down & Click "New Installation".
-- Check "I Accept" & Click Next.
-- MySQL database settings:
     Database Host: localhost
     Port: 3306
     Database Login: chamilo
     Database Password: password
     Main Chamilo database (DB): chamilodb
  
-- Click on "Check Database Connection".
-- Click Next.
-- Config settings:
     Administrator login: admin
     Administrator Password: Passw0rd
     Administrator first name: Koushik
     Administrator last name: Chatterjee
     Administrator email: kchatterjee@domain.com
  
-- Click Next.
-- Click "Install Chamilo".
-- Click "Go to Your Newly Created Portal".
     User: admin
     Pass: Passw0rd

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

 

Sunday 26 February 2017

Setup Chat Support On Your Website With Mibew Messenger on CentOS 6x

Mibew Messenger on CentOS 6x


Q. What is Mibew Messenger ?

-- Mibew Messenger, also known as Open Web Messenger, is an open-source live/chat support application written in PHP and MySQL. It enables one-on-one chat assistance in real-time directly from your website. Just place the Mibew Messenger button at your site, the visitors of your site will be able to get assistance from your operators, technical support executives and customer support executives who help them by clicking on the chat button.

Features:

– Visitors can do real-time chat without page refresh.
– Unlimited operators, chats, and users.
– Unlimited departments (groups of operators).
– Priority queue of visitors.
– Localized to 10+ languages, unicode support.
– Runs on your server and domain.
– Complete free and Open source.

Step: 1. Bind Hosts File :

# vi /etc/hosts

192.168.72.220    ser1.domain.com ser1

-- Save & Quit (:wq)

Step: 2. Disabled Firewall & Selinux :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 3. Install Apache Server :

# yum -y install httpd httpd-devel wget unzip

Step: 4. Install MySQL Server :

# yum -y install mysql mysql-server mysql-devel

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

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 6. Install PHP5 Scripting Language :

# yum -y install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel \
    php-xml php-imap php-ldap php-mbstring php-odbc php-pear php-xmlrpc php-soap \
    mod_ssl php-cli
 
Step: 7. Start Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 8. Create Database For Mibew :

# mysql -u root -p
Enter Password:

mysql> create database mibewdb;
mysql> grant all privileges on mibewdb.* TO mibew@localhost identified by 'password';
mysql> grant all privileges on mibewdb.* TO mibew@'%' identified by 'password';
mysql> flush privileges;
mysql> exit

Step: 9. Download & Install Mibew :

# mkdir /var/www/html/mibew
# cd /var/www/html/mibew
# wget https://netix.dl.sourceforge.net/project/mibew/core/2.2.0/mibew-2.2.0.zip
# unzip mibew-2.2.0.zip
# rm -rf mibew-2.2.0.zip

Step: 10. Set Privileges to Mibew Directory :

# chown -Rf root:apache /var/www/html/mibew/
# chmod -Rf 755 /var/www/html/mibew/

Step: 11. Set your Mibew Application Path & DB Settings :

# vi /var/www/html/mibew/libs/config.php

$webimroot = "/mibew";

*  MySQL Database parameters
 */
$mysqlhost = "localhost";
$mysqldb = "mibewdb";
$mysqllogin = "mibew";
$mysqlpass = "password";
$mysqlprefix = "";

-- Save & Quit (:wq)

Step: 12. Now, Point your Web Browser & Type :

http://192.168.72.220/mibew/install

-- Click on Create Required Tables link.

User: "admin" with blank Password.

-- Edit General Operator Settings:
     Login: admin
     Email: kchatterjee@domain.com
     Password: Passw0rd
     Confirmation: Passw0rd
     Name: Koushik Chatterjee
  
-- Click on Save.

Step: 13. For Security Reason Remove the /mibew/install/ folder :

# rm -rf /var/www/html/mibew/install/

Step: 14. Add the Chat Button on My Website :

-- Go to the Mibew Admin Console.
-- Click on Button Code.
-- Copy the HTML Code & you can Paste them in your Website at any place.
-- You can Change the Chat image using Choose image Button & can Change the Chat window Style as well.

Step: 15. To View the Emails :

-- Open Mibew Admin Panel (http://192.168.72.220/mibew)
-- Login into Admin User.
-- Click on Notification.

You can See the All Emails there.

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

 

Sunday 19 February 2017

How to Configure Online Shopping Store Using osCommerce on CentOS/RHEL 6x & Ubuntu 14.04

How to Configure Online Shopping Store Using osCommerce on CentOS/RHEL 6x & Ubuntu 14.04


Q. What is osCommerce ?

-- OsCommerce (Online Shopping Store) is an e-commerce and Online Store-Management Software program. It can be used on any web server that has PHP and MySQL installed. It is available as free software under the GNU General Public License.

Step: 1. Bind Hosts File :


# vi /etc/hosts

192.168.72.221    ser2.domain.com    ser2

-- Save & Quit (:wq)

Step: 2. Stop Firewall :

For CentOS/RHEL Users :

# service iptables stop
# chkconfig iptables off

For Debian Users :

# service ufw stop

Step: 3. Disable Selinux :

Important: This 3rd Step, is only Applicable for RedHat & CentOS Based Systems only, Debian & Ubuntu users skip this Step.

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Important: In Case you Don’t want to Disable Selinux you can use the Following Command to over-ride policy :

# chcon -R -t httpd_sys_content_rw_t /var/www/html/

Step: 4. Reboot the System :

# init 6

Step: 5. Install Apache Server :

For CentOS/RHEL Users :

# yum -y install httpd httpd-devel

For Debian Users :

# apt-get -y install apache2

Step: 6. Install PHP :

For CentOS/RHEL Users :

# yum -y install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel \
    php-xml php-imap php-ldap php-mbstring php-odbc php-pear php-xmlrpc php-soap php-cli \
    php-pdo php-intl mod_ssl
 
For Debian Users :

# apt-get -y install php5 php5-mysql libapache2-mod-php5

Step: 7. Restart Apache Service :

For CentOS/RHEL Users :

# service httpd restart
# chkconfig httpd on

For Debian Users :

# service apache2 restart

Step: 8. Install MySQL Server :

For CentOS/RHEL Users :

# yum -y install mysql mysql-server mysql-devel

For Debian Users :

# apt-get -y install mysql-client mysql-server

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

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation

Step: 10. Create Database For osCommerce :

# mysql -u root -predhat

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

Step: 11. Install Following System Utilities :

For CentOS/RHEL Users :

# yum -y install wget unzip

For Debian Users :

# apt-get -y install wget unzip

Step: 12. Download OsCommerce Online Shopping Package :

# cd /var/www/html
# wget http://www.oscommerce.com/files/oscommerce-2.3.4.zip
# unzip oscommerce-2.3.4.zip
# mv oscommerce-2.3.4/catalog /var/www/html/commerce
# rm -rf oscommerce-2.3.4 oscommerce-2.3.4.zip

Step: 13. Give Appropriate Permission :

# chmod 777 /var/www/html/commerce/includes/configure.php
# chmod 777 /var/www/html/commerce/admin/includes/configure.php

Step: 14. Installing OsCommerce Online Shopping Package through Web Browser :

http://<ip_or_domain>/commerce/install

-- Click on "Start"
-- Database Server:
     Database Server: localhost
     Username: commerce
     Password: password
     Database Name: commercedb
  
-- Click on "Continue"
-- Web Server:
     WWW Address: http://192.168.72.221/commerce/
     Webserver Root Directory: /var/www/html/commerce/
  
-- Click on "Continue"
-- Online Store Settings:
     Store Name: Your Store Name
     Store Owner Name: Koushik Chatterjee
     Store Owner E-Mail Address: kchatterjee@domain.com
     Administrator Username: admin
     Administrator Password: Passw0rd
     Time Zone: select Kolkata

-- Click on "Continue"

Step: 15. Secure the osCommerce Online Shopping Store :

# rm -rf /var/www/html/commerce/install/
# chmod 644 /var/www/html/commerce/includes/configure.php
# chmod 644 /var/www/html/commerce/admin/includes/configure.php

Step: 16. To Check & Set the Appropriate Permission :

http://192.168.72.221/commerce/admin/login.php
Username: admin
Password: Passw0rd

-- Click on "Tools"
-- "Security Directory Permissions".

# chmod -R 775 /var/www/html/commerce/images/
# chown -R root:apache /var/www/html/commerce/images/
# chmod -R 775 /var/www/html/commerce/pub/
# chown -R root:apache /var/www/html/commerce/pub/
# chmod -R 755 /var/www/html/commerce/includes/
# chmod -R 755 /var/www/html/commerce/admin/
# chown -R root:apache /var/www/html/commerce/admin/backups/
# chmod -R 775 /var/www/html/commerce/admin/backups/
# chmod -R 775 /var/www/html/commerce/includes/work/
# chown -R root:apache /var/www/html/commerce/includes/work/

# chmod -R 775 /var/www/html/commerce/images/
# chown -R root:apache /var/www/html/commerce/images/
# chmod -R 775 /var/www/html/commerce/pub/
# chown -R root:apache /var/www/html/commerce/pub/
# chmod -R 755 /var/www/html/commerce/includes/
# chmod -R 755 /var/www/html/commerce/admin/
# chown -R root:apache /var/www/html/commerce/admin/backups/
# chmod -R 775 /var/www/html/commerce/admin/backups/
# chmod -R 775 /var/www/html/commerce/includes/work/
# chown -R root:apache /var/www/html/commerce/includes/work/

-- Click on "Configuration"
-- Click on "Administrator"

# chmod 775 /var/www/html/commerce/admin/.htpasswd_oscommerce
# chmod 775 /var/www/html/commerce/admin/.htaccess
# chgrp apache /var/www/html/commerce/admin/.htpasswd_oscommerce
# chgrp apache /var/www/html/commerce/admin/.htaccess
   
-- Again Click on "Administrator"
-- Click on "Edit" Button.
-- Give Admin User Name & Password.
-- Check on "Protect With htaccess/htpasswd".
-- Finally Click on "Save" Button.

http://192.168.72.221/commerce/

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


Saturday 11 February 2017

How To Configure GlusterFS on Centos/RHEL 6x

How To Configure GlusterFS on Centos/RHEL 6x


Q. What is GlusterFS ?

-- GlusterFS is an open source, powerful clustered file system capable of scaling to several petabytes of storage which is available to user under a single mount point. It uses already available disk filesystems like ext3, ext4, xfs etc to store data and client will able to access the storage as local filesystem. GlusterFS cluster aggregates storage blocks over Infiniband RDMA and/or TCP/IP interconnect in a single global namespace.

Before the Installation:

Ensure that TCP and UDP ports 24007 and 24008 are open on all Gluster Servers.
Apart from these ports, you need to open one port for each brick starting from port 24009.
For example: if you have five bricks, you need to have ports 24009 to 24014 open.

Step: 1. Make sure to Add the bind the hostname of every Servers :

# vi /etc/hosts
   
192.168.100.220 ser1.domain.com   ser1   # (Server)
192.168.100.221 ser2.domain.com   ser2   # (Server)
192.168.100.229 ser5.domain.com   ser5   # (Client)

-- Save & Quit (:wq)

Step: 2. Stop Firewall & Disable the Selinux (All Nodes) :

# iptables -L
   
# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux
   
SELINUX=disabled
   
-- Save & Quit (:wq)

Step: 3. Reboot the All Servers :

# init 6
               
Step: 4. Time Synchronization NTP (Both Nodes) :

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

Step: 5. Install Epel Repo (All Servers) :

# yum -y install epel-release

Step: 6. Installation Gusterfs (on ser1.domain.com & ser2.domain.com) :

# cd /tmp
# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
# yum -y install glusterfs glusterfs-fuse glusterfs-server

Step: 7. Installation on Client (ser5.domain.com) :

On Client execute following command to install clusterfs client side packages.

# cd /tmp
# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
# yum -y install glusterfs glusterfs-fuse fuse fuse-libs libibverbs
   
Step: 8. Start Glusterfs Service (on Ser1 & Ser2):

# service glusterd start
# chkconfig glusterfsd on
   
Step: 9. Creating Trusted Storage Pool (on Ser1.domain.com):

-- Trusted storage pool are the servers which are running as gluster servers and will provide bricks for volumes. You will need to probe all servers to the main server ( here : ser1 is main server ) (don't probe ser1 or localhost). We will now create all three servers in a trusted storage pool and probing will be done on ser1.

# gluster peer probe 192.168.100.221
OR
# gluster peer probe ser2

Probe successful.

# gluster peer status
   
-- To Remove Server from the Trusted Storage Pool :

# gluster peer detach ser1

Step: 10. Creating Replicated Glusterfs Server Volume (on Ser1.domain.com) :

-- A gluster volume is a logical collection of bricks where each brick is an export directory on a server in the trusted storage pool. Use replicated volumes in storage where high-availability and high-reliability are critical because replicated volumes create same copies of files across multiple bricks in the volume.

Important Note: /data is New Attached Volume for Ser1 & Ser2.

# gluster volume create rep-volume replica 2 ser1:/data ser2:/data force
   
Here: force is used as gluster permits us to create the volume in another disk only.
   
Step: 11. Starting the replicated volume (on Ser1.domain.com) :

# gluster volume start rep-volume
# gluster volume info
# gluster pool list

Step: 12. We cannot mount the /data bricks by the same name. So mounting it on /shared. on both the servers (on Ser1 & Ser2) :

# mkdir /shared
# mount -t glusterfs ser1:/rep-volume /shared
# df -h
   
-- Now add following line at the end of /etc/fstab file to make it available to server on every reboot.

# vi /etc/fstab
   
ser1.domain.com:/rep-volume /shared glusterfs defaults,_netdev 0 0

-- Save & Quit (:wq)
       
On Client Machine :
===============
You can just mount and the gluster volume is ready.
   
# mkdir /shared
# mount -t glusterfs ser1:/rep-volume /shared
# df -h
# vi /etc/fstab
       
ser1.domain.com:/rep-volume /shared glusterfs defaults,_netdev 0 0

-- Save & Quit (:wq)
   
Create a file in any of the nodes and Check the replication is working in all the nodes.

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

 

Saturday 4 February 2017

How To Configure Pen-Load Balancer on Centos/RHEL 6x

How To Configure Pen-Load Balancer on Centos/RHEL 6x


Q. What is PEN ?

-- Install Pen to configure Load Balance server. Pen is a light weight simple load balancer. This example shows to configure on the environment like follows.

Scenario:
=======
192.168.100.229    ser5.domain.com     ser5 - PEN Server
192.168.100.220    ser1.domain.com     ser1 - Web Server1
192.168.100.221    ser2.domain.com     ser2 - Web Server2

Step: 1. Bind Hosts File (All Servers) :

# vi /etc/hosts

192.168.100.229    ser5.domain.com     ser5
192.168.100.220    ser1.domain.com     ser1
192.168.100.221    ser2.domain.com     ser2

-- Save & Quit (:wq)

Step: 2. Install and Configure Pen (192.168.100.229-ser5.domain.com) :

# cd /tmp
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm

# yum -y install pen

# vi /etc/pen.conf

-- Paste the Following Lines :

# log file
LOGFILE=/var/log/pen.log

# output file of status
WEBFILE=/var/www/pen/webstats.html

# control port
CONTROL=127.0.0.1:10080

# max connections
MAX_CONNECTIONS=500

# listen port
PORT=80

# number of backend servers
BACKEND=2

# IP address of a backend webserver
SERVER1=192.168.100.220:80

# IP address of a backend webserver
SERVER2=192.168.100.221:80

-- Save & Quit (:wq)

Step: 3. Create init Script for Pen :

# vi /etc/rc.d/init.d/pend

#!/bin/bash

# pend: Start/Stop Pend
# chkconfig: - 90 10
# description: Pen is a light weight simple load balancer.
# pidfile: /var/run/pen.pid

. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
. /etc/pen.conf

LOCKFILE="/var/lock/subsys/pen"
PID=/var/run/pen.pid
PROG=/usr/bin/pen

RETVAL=0
start() {
   echo -n $"Starting Pend: "
   SERVER=`grep "^SERVER" /etc/pen.conf | cut -d= -f2`
   daemon $PROG -w $WEBFILE -x $MAX_CONNECTIONS -p $PID -l $LOGFILE -C $CONTROL -S $BACKEND -r $PORT $SERVER
   RETVAL=$?
   echo
   [ $RETVAL -eq 0 ] && touch $LOCKFILE
   return $RETVAL
}
stop() {
   echo -n $"Stopping Pend: "
   killproc $PROG
   RETVAL=$?
   echo
   [ $RETVAL -eq 0 ] && rm -f $PID $LOCKFILE
   return $RETVAL
}
case "$1" in
   start)
      start
      ;;
   stop)
      stop
      ;;
   status)
      status pend
      ;;
   restart)
      stop
      start
      ;;
   *)
      echo $"Usage: $0 {start|stop|status|restart}"
      exit 1
esac
exit $?

-- Save & Quit (:wq)

Step: 4. Setting up Log Rotation :

# vi /etc/logrotate.d/pen

/var/log/pen.log {
   daily
   copytruncate
   compress
   notifempty
   missingok
   postrotate
     /etc/rc.d/init.d/pend restart 2>&1 > /dev/null || true
   endscript
}

-- Save & Quit (:wq)

# chmod 755 /etc/rc.d/init.d/pend
# service pend start
# chkconfig --add pend
# chkconfig pend on

Step: 5. Install & Configure Backend Web Server (Web-Server1 & Web-Server2) :

# yum -y install httpd httpd-devel
# cd /var/www/html
# vi index.html

<html>
<body bgcolor="black">
<marquee><font size="8" color="yellow"> This is Web-Server1...!!!</font></marquee>
</body>
</html>

-- Save & Quit (:wq)

# service httpd restart
# chkconfig httpd on

On Web-Server2 :

# yum -y install httpd httpd-devel
# cd /var/www/html
# vi index.html

<html>
<body bgcolor="black">
<marquee><font size="8" color="yellow"> This is Web-Server2...!!!</font></marquee>
</body>
</html>

-- Save & Quit (:wq)

# service httpd restart
# chkconfig httpd on

Step: 6. Now, Point Your Web Browser & Type :

http://192.168.100.229  # Pen Server IP Address.

Step: 7. Configure the tool that it's possible to watch Pen's Status :

# cp /usr/share/doc/pen-*/penstats /var/www/pen
# vi /var/www/pen/penstats

# Line No. 4: Change to:

PIDFILE=/var/run/pen.pid

# Line No. 5: Change to:

WEBFILE=/var/www/pen/webstats.html

-- Save & Quit (:wq)

Step: 8. Install Apache Server for See Pen Status :

# yum -y install httpd httpd-devel

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

Chenge Listen Port to:

Listen 8080

-- Save & Quit (:wq)

# mv /etc/httpd/conf.d/pen.conf /etc/httpd/conf.d/pen.conf.bak
# vi /etc/httpd/conf.d/pen.conf

Alias /pen/ /var/www/pen/
<Directory /var/www/pen/>
   DirectoryIndex penctl.cgi
   Options ExecCGI
   order deny,allow
   deny from all
   allow from 127.0.0.1 192.168.100.0/24   # IP address you permit
</Directory>

-- Save & Quit (:wq)

# service httpd restart
# chkconfig httpd on
# service pend restart

Step: 10. Run the Following Command :

# chmod 755 /var/www/pen/penstats
# /var/www/pen/penstats > /dev/null

Step: 10. Schedule in Crontab (Update by 1 minutes) :

# crontab -e

*/1 * * * * /var/www/pen/penstats > /dev/null

-- Save & Quit (:wq)

# service crond restart

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


Copyright © 2016 Kousik Chatterjee's Blog