Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Sunday, 24 November 2019

How To Configure SonarQube on Ubuntu 16.04



Q. What is SonarQube ?

-- SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities on 20+ programming languages. SonarQube offers reports on duplicated code, coding standards, unit tests, code coverage, code complexity, comments, bugs, and security vulnerabilities.

SonarQube includes support for the programming languages Java (including Android), C#, PHP, JavaScript, TypeScript, C/C++, Ruby, Kotlin, Go, COBOL, PL/SQL, PL/I, ABAP, VB.NET, VB6, Python, RPG, Flex, Objective-C, Swift, CSS, HTML, and XML.


Requirements:
  • Ubuntu 16.04 Server
  • 2 GB of RAM to run efficiently and 1 GB of free RAM (Preferred 4 GB RAM) 
  • Disk Space: Depending on utilization (Preferred 50 GB) 
  • Instance volume type must be excellent read & write performance 
  • SonarQube does not support 32-bit systems on the server side. 
  • Open JDK 8 or Oracle Java 8
  • Database MySQL 5.7 (Preferred MSSQL)

Installation:

Step: 1. Update System & Install required Packages :

# apt-get update && apt-get -y upgrade
# apt-get -y install -y wget unzip zip
 

Step: 2.  Install Oracle Java :

# cd /opt
# mkdir java
# wget https://github.com/frekele/oracle-java/releases/download/8u212-b10/jdk-8u212-linux-x64.tar.gz
# tar -xzvf jdk-8u212-linux-x64.tar.gz -C /opt/java --strip-components=1
# update-alternatives --install /usr/bin/java java /opt/java/bin/java 100
# update-alternatives --install /usr/bin/javac javac /opt/java/bin/javac 100
# java -version
# echo $JAVA_HOME

Step: 3. Create user for SonarQube :

 
# sudo adduser --system --no-create-home --group --disabled-login sonarqube


Step: 4. Install MySQL Server & Create User for SonarQube :

 
# apt-get -y install mysql-server-5.7 mysql-server-core-5.7

# mysql_secure_installation

# mysql -u root -p

Enter Password:

MySQL> CREATE DATABASE sonardb CHARACTER SET utf8 COLLATE utf8_bin;
MySQL> GRANT ALL on sonardb.* TO 'sonarqube'@'localhost' IDENTIFIED BY 'sonardb#321';
MySQL> FLUSH PRIVILEGES;
MySQL> exit;


Step: 5. Install SonarQube :

 
# cd /opt/
# wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.7.zip
# unzip sonarqube-7.7.zip
# mv sonarqube-7.7 sonarqube
# sudo chown -R sonarqube:sonarqube /opt/sonarqube
# vi sonarqube/conf/sonar.properties

     sonar.jdbc.username=sonarqube
     sonar.jdbc.password=sonardb#321
     sonar.jdbc.url=jdbc:mysql://localhost:3306/sonardb?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useSSL=false
     sonar.web.javaOpts=-server
     sonar.web.host=0.0.0.0
     sonar.web.port=9000
     sonar.web.context=/sonarqube (for If you want to web access like https://www.example.com/sonarqube)


-- Save & Quit (:wq)


Step: 6. Create Service for SonarQube :

 
# vi /etc/systemd/system/sonarqube.service
 
  [Unit]
  Description=SonarQube service
  After=syslog.target network.target

  [Service]
  Type=forking

  ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
  ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop

  User=sonarqube
  Group=sonarqube
  Restart=always

  [Install]
  WantedBy=multi-user.target


-- Save & Quit (:wq)

# systemctl daemon-reload

Step: 7. SonarQube Service Commands :

 
# service sonarqube start
# service sonarqube status
# service sonarqube stop

Step: 8. Install SonarScanner for Scanning :

 
# cd /opt
# wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-linux.zip
# unzip sonar-scanner-cli-3.3.0.1492-linux.zip
# mv sonar-scanner-3.3.0.1492-linux sonarscanner
# sudo chown -R sonarqube:sonarqube /opt/sonarscanner
# vi sonarscanner/conf/sonar-scanner.properties
    
    sonar.host.url=http://localhost:9000

-- Save & Quit (:wq)

# chmod +x sonarscanner/bin/sonar-scanner
# sudo ln -s /opt/sonarscanner/bin/sonar-scanner /usr/local/bin/sonar-scanner



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

Thursday, 11 April 2019

How To Configure GlusterFS on Ubuntu 16.04

GlusterFS_Cluster




Introduction:


-- GlusterFS is a free, open source and scalable network filesystem specially designed for 
data-intensive tasks such as cloud storage and media streaming. GlusterFS made up of two 
components a server and a client. The server runs glusterfsd and the client used to mount the
exported filesystem. You can achieve high availability by distributing the data across the multiple 
volumes/nodes using GlusterFS. GlusterFS client can access the storage like local storage. GlusterFS is a file-based scale-out storage that allows you to combine large numbers of 
commodity storage and compute resources into a high performance and virtualized pool. 
You can scale both capacity and performance on demand from terabytes to petabytes.

Requirements:

1. Two AWS EC2 instance for GlusterFS server with Ubuntu 16.04 and 20 GB external 
HDD on each. 
2. One AWS EC2 instance for GlusterFS client with Ubuntu 16.04 installed.
3. A static IP address 172.31.85.78 on glusterfs1 172.31.83.5 on glusterf2 and 172.31.82.27 

on glusterclient client is configured.

Note: On security group of all instances we need to allow the ports 111,24007,24008,
38465 to 38467,49152 to 49154,All ICMP port.


Installation Process of GlusterFS Servers:


Step: 1. Update your base system with the latest available packages :

# apt-get -y update

Step: 2. Login to the GlusterFS Servers & set the hostnames as glusterfs1 & glusterfs2 :

# hostname glusterfs1
# hostname glusterfs2

# vi /etc/hostname

glusterfs1

-- Save & Quit (:wq)

Step: 3. Configure Hostname Resolution:

# vi /etc/hosts

-- Add the following lines:

172.31.83.5 glusterfs2
172.31.85.78 glusterfs1

-- Save & Quit (:wq)

Step: 4. Install GlusterFS on Server1 & Server2:

# apt-get -y install apt-transport-https
# add-apt-repository -y ppa:gluster/glusterfs-4.1
# apt-get update -y
# apt-get -y install glusterfs-server
# systemctl enable glusterd.service
# systemctl start glusterd.service

Note: If facing any issue while adding GlusterFS Repository then do the following:

# vi /usr/bin/add-apt-repository

-- Change package header from `python3` to `python3.5` (or lower)

-- Save & Quit (:wq)

Step 5. Configure GlusterFS Storage:

# mkdir -p /gshare

Next, create a persistent mount point by editing /etc/fstab file:

# vi /etc/fstab

-- Add the following line:

/dev/xvdb /gshare ext4 defaults 0 0

-- Save & Quit (:wq)

# mount -a

Step: 6. Configure GlusterFS Storage Pool:

-- Run this command on GlusterFS Server 1:

# gluster peer probe glusterfs2
# gluster volume create gdata replica 2 glusterfs1:/gshare glusterfs2:/gshare force

-- You can verify the status of the trusted storage pool with the following command Output should
be like this peer probe: success.

#  gluster peer status

Step: 7. Configure GlusterFS Volume:

# gluster volume create gdata replica 2 glusterfs1:/gshare glusterfs2:/gshare force
# gluster volume start gdata

-- Checking the volume status on both server:

# gluster volume status

-- You can now check the status of created volume with the following command:

# gluster volume info gdata

Installation Process of GlusterFS Client:


Step: 1. Update your base system with the latest available packages:

# apt-get -y update

Step: 2. Login to the client and set the hostnames:

# hostname glusterclient

# vi /etc/hostname

glusterclient

-- Save & Quit (:wq)

Step: 3. Configure Hostname Resolution:

# vi /etc/hosts

-- Add the following lines:

172.31.83.5 glusterfs2
172.31.85.78 glusterfs1
172.31.82.27 glusterclient

-- Save & Quit (:wq)

ping glusterfs1
ping glusterfs2
ping glusterclient

Step: 4. Install GlusterFS Client:

# apt-get install apt-transport-https -y
# add-apt-repository ppa:gluster/glusterfs-4.1
# apt-get -y update

# apt-get -y install glusterfs-client

Note: If facing any issue while adding GlusterFS Repository the do the following:

# vi /usr/bin/add-apt-repository

-- Change package header from `python3` to `python3.5` (or lower)

-- Save & Quit (:wq)

Step 5. Create a directory to mount GlusterFS filesystem:

# mkdir /storage-pool

-- Create a persistent mount point by editing fstab file:

# vi /etc/fstab file

glusterfs2:/gdata /storage-pool glusterfs defaults,_netdev 0 0

-- Save & Quit (:wq)

# mount -a

-- Testing the Replication Features:

On our client machine (glusterclient), we can type this to add some files into our storage-pool directory:

# cd /storage-pool
# touch file.txt

If we look at our /gshare directories on each storage server, we will see that file is present on each system:

# cd /gshare (on glusterfs1 and glusterfs2 server)
# ls

-- Testing the High-availability Features:

To check the high-availability, shutdown the glusterfs2 instance. Now, goto the
glusterclient client instance and check the availability of the files:

On glusterclient:

# ls -l /storage-pool

You should see the file even though the glusterfs2 is down.

Next, create some files on glusterclient

# touch /storage-pool/file21.txt
# touch /storage-pool/file22.txt

All the files are now written on glusterfs1. Now, start the glusterfs2 instance.

Now, check the /gshare directory on both servers.

# ls -l /gshare

You should see all files there.

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

Sunday, 24 June 2018

How To Install Jenkins on Ubuntu 16.04


 

About Jenkins:

-- Jenkins is a Continuous Integration (CI) server or tool which is written in java. The software enables developers to find and solve defects in a code base rapidly and to automate testing of their builds.

Step: 1. Update & Upgrade the System :

# apt-get update && apt-get -y upgrade
# apt-get -y install zip unzip wget curl rsync telnet

Step: 2. Install JDK 8 :

# apt-get -y install software-properties-common
# add-apt-repository ppa:webupd8team/java -y
# apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 -y
# apt-get update
# apt-get -y install oracle-java8-installer

Step: 3. Set JAVA_HOME Environment Variables :

# vi /etc/profile.d/java.sh

#!/bin/bash
JAVA_HOME=/usr/lib/jvm/java-8-oracle/
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
export CLASSPATH=.

-- Save & Quit (:wq)

# chmod +x /etc/profile.d/java.sh
# source /etc/profile.d/java.sh
# echo $JAVA_HOME
# java -version

java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

Step: 4. Download & Install Jenkins :

# wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
# sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
# apt-get -y update
# apt-get -y install jenkins
# service jenkins start
or
# systemctl start jenkins

Step: 5. Setting up Jenkins (Jenkins GUI Configurations) :


-- To use and configure Jenkins, visit the following address in your browser.

http://your-ip-address:8080

We should see "Unlock Jenkins" screen, which displays the location of the initial password.

# cat /var/lib/jenkins/secrets/initialAdminPassword

We'll copy the 32-character alphanumeric password from the terminal and paste it into the "Administrator password" field, then click "Continue". The next screen presents the option of installing suggested plugins or selecting specific plugins.


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

Sunday, 15 October 2017

Mount S3 Bucket using IAM Role on Ubuntu 16.04

Mount S3 Bucket using IAM Role on Ubuntu 16.04


Q. What Is Amazon S3?

-- Amazon Simple Storage Service is storage for the Internet. It is designed to make web-scale computing easier for developers. Amazon S3 has a simple web services interface that you can use to store and retrieve any amount of data, at any time, from anywhere on the web.

Step: 1. Create a new Policy to Access the target S3 Bucket : 

1















-- Enter Policy Name, Description and the Policy Document as given below :

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetBucketLocation",
        "s3:ListAllMyBuckets"
      ],
      "Resource": "arn:aws:s3:::*"
    },
    {
      "Effect": "Allow",
      "Action": ["s3:ListBucket"],
      "Resource": ["arn:aws:s3:::bucket-name"]
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject"
      ],
      "Resource": ["arn:aws:s3:::bucket-name/*"]
    }
  ]
}

2



















Step: 2. Create a New Role using "Amazon EC2" Service Role Type :

-- Click on “Create new Role” and Select Role Type as Amazon EC2.

3
















-- Next select “s3access” policies to Attach.

4










-- Enter Role Name, Description as given below and click on “Create Role” button.

5



















-- The Attach Policy of the new Role should look like below:

6



















Step: 3. Attach IAM Role to the running Instance or Launching new Instance :

7
















-- Select Role name from drop-down box and click on “Apply” button.

8









9








Step: 4. Mount S3 Bucket to an Instance :

-- Login to instance using console and follow the steps below :

# apt-get update -y
# apt-get install build-essential libfuse-dev libcurl4-openssl-dev libxml2-dev \
    mime-support automake libtool git
# cd /tmp
# git clone https://github.com/s3fs-fuse/s3fs-fuse.git
# cd s3fs-fuse/
# ./autogen.sh
# ./configure
# make
# make install
# mkdir /s3backups
# chmod 755 /s3backups

-- Now Mount the S3 Bucket using IAM Role :

# s3fs -o iam_role="EC2RoleForS3Access" bucket-name /s3backups
# df -Th

[OUTPUT]
Filesystem     Type         Size       Used  Avail   Use%  Mounted on
s3fs                 fuse.s3fs  256T     0         256T   0%      /s3backups

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



Sunday, 27 August 2017

How To Configure SVN (Subversion) Server on RHEL/Centos 6x

How To Configure SVN (Subversion) Server on RHEL/Centos 6x


Q. What is SVN (Subversion)?

-- Subversion is a free/open-source version control system. Subversion manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data, or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of "time machine".

Step: 1. Install Apache Server :

# yum -y install httpd httpd-devel mod_ssl

Step: 2. Configure Apache Server :

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

-- Uncomment :

NameVirtualHost *:80

-- Add the following Lines at the End :

DocumentRoot "/var/www/html"
RewriteEngine on
CheckCaseOnly On

-- Save & Quit (:wq)

Step: 3. Install SVN Packages :

# yum -y install mod_dav_svn subversion

Step: 4. Modify Subversion config file :

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

-- Add following config to /etc/httpd/conf.d/subversion.conf file.

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

<Location /repos>
  DAV svn
  SVNParentPath /var/www/svn/repos
  AuthType Basic
  AuthName "Welcome To KMInfosystems VersionControl"
  AuthUserFile /var/www/svn/secure/svn-users
  AuthzSVNAccessFile /var/www/svn/secure/svn-access-control
  Require valid-user
</Location>

-- Save & Quit (:wq)

Step: 5. Restart the httpd Service :

# service httpd restart
# chkconfig httpd on

Step: 6. Add SVN (Subversion) Users :

-- At First Create User Directory :

# mkdir -p /var/www/svn/secure/

-- For 1st User :

# htpasswd -cm /var/www/svn/secure/svn-users koushik

-- For 2nd User :

# htpasswd -m /var/www/svn/secure/svn-users user1
# htpasswd -m /var/www/svn/secure/svn-users user2
# htpasswd -m /var/www/svn/secure/svn-users user3

Step: 7. Create SVN Access Control List :

# cd /var/www/svn/secure/
# touch svn-access-control
# vi svn-access-control

[groups]
admin = koushik
testrepo = user2,user3
prodrepo = user1

[/]
@admin = rw

[testrepo:/]
@testrepo = rw

[prodrepo:/]
@prodrepo = rw

-- Save & Quit (:wq)

Step: 8. Create and configure SVN Repository :

# mkdir /var/www/svn/repos
# cd /var/www/svn/repos

# svnadmin create testrepo
# chmod -Rf 777 testrepo

# svnadmin create prodrepo
# chmod -Rf 777 prodrepo

Step: 9. Restart Apache Server :

# service httpd restart

Step: 10. Point Your Web Browser :

http://192.168.72.140/repos/testrepo/

User: koushik
Pass: redhat

Step: 11. Configure Repository (Optional) :

To disable anonymous access and enable access control add following rows to svnserve.conf file.

# vi /var/www/svn/repos/testrepo/conf/svnserve.conf

## Disable anonymous access ##
anon-access = none

## Enable access control ##
authz-db = authz

-- Save & Quit (:wq)

Step: 12. Create trunk, branches and tags structure under testrepo :

# mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Step: 13. Then import Template to Project Repository using “svn import” command :

# svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/repos/testrepo/

Password for 'root': (Just Press Enter)

Authentication realm: <http://localhost:80> Subversion repositories

Username: user1
Password for 'user1': redhat

Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags

Store password unencrypted (yes/no)? yes

Committed revision 1.

Note: Check results on browser and see testrepo revision 1.

http://192.168.72.140/repos/testrepo

User: user2, user3
Pass: redhat

http://192.168.72.140/repos/prodrepo

User: user1 (only user1)
Pass: redhat

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


Sunday, 30 July 2017

How To Configure Password Protected Directory in IIS 7

How To Configure Password Protected Directory in IIS 7


Step: 1. Install IIS on Windows Server 2008/2012 :

-- Go To "Server Management"
-- Click on "Roles"
-- Add Roles
-- Click on "Next".
-- Select Web Server (IIS)
-- Add Required Features.
-- Click on "Next"
-- Click on "Next"
-- Select Windows Authentication, ASP.Net, CGI
-- Click on "Next"
-- Finally, Click on "Install".
-- Close.

Note: If you have already Install IIS then open Server Management and follow these steps.

-- Expand "Roles"
-- Click on "Web Server (IIS)"
-- Scroll Down the Page & Click on Add Role Services
-- Then Select "Windows Authentication"
-- Click on "Next"
-- Finally, Click on "Install"
-- Close.

Step: 2. Configure IIS Server :

Go To C:\inetpub\wwwroot and Create a "index.html" File & also Create a Directory called "Secret" under Secret Directory create a html file called "sectet.html"

index.html code

<html>
<body bgcolor="black">
<h1><center><font size="8" color="white">This is My Home Page...</center></font></h1>
<BR>
<a href="secret/secret.html"><font size="4" color="yellow">secret.html</a></font></BR>
</body>
</html>


-- Save the File.

secret.html code

<html>
<h1><font size="6" color="black">This is My secret Doc...</font></h1>
</html>


-- Save the File.

After created .html files follow these steps.

-- Open IIS Manager.
-- Expand Server Name.
-- Expand Sites
-- Right Click on "Sites"
-- Add Web Site
-- Give Site Name (secret)
-- Select Path (C:\inetpub\wwwroot) Give Hostname (localhost)
-- Click on "OK".

-- Click on Newly created site.
-- Double Click on Default Document.
-- Move Up "index.html".

-- Click on Newly Create site
-- Double Click on Directory Browsing
-- Click on "Enable".

Step: 3. Create A System User :

-- Click on "Start"
-- Administrative Tools
-- Computer Management
-- Expand Local Users & Groups
-- Click on "Users"
-- Right Click on Blank Space.
-- New User.
-- Give Username & Password
-- Click on "Create".
-- Click on "Close".

Step: 4. Security Setup for IIS :

-- Go To C:\inetpub\wwwroot
-- Right Click on Secret Directory
-- Click on Properties.
-- Security (Tab)
-- Click on Advanced
-- Change Permissions.
-- Select Users.
-- Uncheck Include Inheritable Permissions from this object's parent.
-- Click on "Add/Copy"
-- Again Select Users
-- Remove
-- Click on "OK"
-- Again Click on "OK"
-- Click on "Edit" button.
-- Click on "Add"
-- Click on "Advanced"
-- Find Now
-- Select User 'secret'
-- Click on "OK"
-- Click on "OK"
-- Check on "Full Control"
-- Click on "OK"
-- Finally, Click on "OK".

-- After that Go To IIS Manager
-- Expand Server Name.
-- Expand Sites.
-- Right Click on Newly Created Site
-- Double Click on Authentication
-- Right Click on Windows Authentication
-- Click on "Enable"
-- Right Click on Anonymous Authentication
-- Click on "Disabled".

-- Right click on Newly created Site.
-- Edit Permission
-- Security (tab)
-- Click on "Edit"
-- Click on "Add" button.
-- Type 'everyone'
-- Click on "Check Names"
-- Click on "OK"
-- OK
-- Finally, Click on "OK".

Step: 5. Testing through web Browser :


http://Server_ip_address - Page Opening

Click on secrect.html -> It Show Restricted Access.

Give Username & Password.

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

 

Sunday, 18 June 2017

How To Install and Configure HAProxy on RHEL/CentOS 6x


How To Install and Configure HAProxy on RHEL/Centos 6x


-- HAProxy (High Availability Proxy) is an open-source load-balancer which can load balance any TCP service. HAProxy is a free, very fast and reliable solution that offers load-balancing, high-availability, and proxying for TCP and HTTP-based applications.

Step: 1. Set Hostname (On All Servers) :

# vi /etc/sysconfig/network

server1.kousik.com

-- Save & Quit (:wq)

# hostname server1.kousik.com

Step: 2. Bind Hosts File (On All Servers) :

# vi /etc/hosts

## IP's of HaProxy ##
192.168.72.181    server1.kousik.com    server1

## IP's of Web Servers ##
192.168.72.182    www1.kousik.com        www1
192.168.72.183    www2.kousik.com        www2

-- Save & Quit (:wq)

 Step: 3. Stop Firewall & Disable Selinux (On All Servers) :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 4. Install NTP Server For Time Synchronization (On All Servers) :

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

Step: 5. Reboot the System (On All Servers) :

# init 6

Step: 6. Copy hosts file to Other Server :

# scp /etc/hosts www1:/etc/
# scp /etc/hosts www2:/etc/

Step: 7. Web Server Configurations :

-- On Both Web Servers :

# yum -y install httpd
# service httpd start
# chkconfig httpd on

-- On Web1 :

# echo "<h1>www1.kousik.com</h1>" > /var/www/html/index.html

-- On Web2 :

# echo "<h1>www2.kousik.com</h1>" > /var/www/html/index.html

-- On LB (HAP) :

# yum -y install epel-release
# yum -y install haproxy
# yum -y remove httpd

# mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.bak
# vi /etc/haproxy/haproxy.cfg

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------

global

    log 127.0.0.1    local0
    log 127.0.0.1    local1 notice
    #log loghost    local0 info
    maxconn 4096
    #debug
    #quiet
    user haproxy
    group haproxy

#---------------------------------------------------------------------
# Defaults that are optimized for a Cloud Servers based
# Infrastructure.
#---------------------------------------------------------------------

defaults

    log global
    mode http
    option httplog
    option dontlognull
    retries 3
    option    redispatch
    maxconn        20000
    contimeout   5000
    clitimeout      50000
    srvtimeout     50000

#---------------------------------------------------------------------
# HTTP Default Webfarm
#---------------------------------------------------------------------

listen webfarm 0.0.0.0:80

    mode http
    stats enable
    stats uri /haproxy?stats
    stats realm Haproxy\ Statistics
    stats auth admin:redhat            # Username is 'admin' & Password is 'redhat'
    balance roundrobin
    cookie JSESSIONID prefix
    option httpclose
    option forwardfor
    option httpchk HEAD /check.txt HTTP/1.0
    server Web01 192.168.72.182:80 cookie A weight 50 check            # Webserver1 IP Address.
    server Web02 192.168.72.183:80 cookie B weight 50 check            # Webserver2 IP Address.

-- Save & Quit (:wq)

# chkconfig haproxy on
# service haproxy start

Step: 8. Open Browser & Type for Statistics :

http://192.168.72.181/haproxy?stats
User: admin
Pass: redhat

Step: 9. Open Web Browser & Check Load Balancing :

http://192.168.72.181


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

 

Saturday, 27 May 2017

How To Configure PredictionIO on CentOS/RHEL 6x

How To Configure PredictionIO on CentOS/RHEL 6x


What is PredictionIO ?

-- PredictionIO is an open source Machine Learning Server. It empowers programmers and data engineers to build smart applications. With PredictionIO, you can add the following features to your apps instantly: predict user behaviors.


Step: 1. Set Host Name :

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

HOSTNAME=predictionio.domain.com

-- Save & Quit (:wq)

Step: 2. Bind Host File :

# vi /etc/hosts

192.168.72.140    predictionio.domain.com        predictionio

-- 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. Download Oracle JAVA :

# cd /opt/
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz"

#  tar -zxvf jdk-8u5-linux-i586.tar.gz

Step: 7. Install JAVA using Alternatives :

# cd jdk1.8.0_05/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_05/bin/java 2
# alternatives --config java


There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /opt/jdk1.8.0/bin/java
 + 2           /opt/jdk1.7.0_55/bin/java
   3           /opt/jdk1.8.0_05/bin/java

Enter to keep the current selection[+], or type selection number which you want to make default. : 3

Step: 8. Check Version of JAVA :

# java -version

java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) Client VM (build 25.5-b02, mixed mode)

Note: If it shows error, Then install the following Package :

# yum -y install glibc.i686
   
Step: 9. Setup Environment Variables :

Setup JAVA_HOME Variable:
   
# export JAVA_HOME=/opt/jdk1.8.0_05

Setup JRE_HOME Variable:

# export JRE_HOME=/opt/jdk1.8.0_05/jre

Setup PATH Variable:

# export PATH=$PATH:/opt/jdk1.8.0_05/bin:/opt/jdk1.8.0_05/jre/bin
   
Step: 10. Change the Environment Variable :

# cd
# vi .bash_profile

-- Add the following lines :

PATH=$PATH:/opt/jdk1.8.0_05/bin:/opt/jdk1.8.0_05/jre/bin
export JAVA_HOME=/opt/jdk1.8.0_05
export JRE_HOME=/opt/jdk1.8.0_05/jre

-- Save & Quit (:wq)

Step: 11. Execute the Bash Profile :
   
# . .bash_profile
 
Step: 12. Download and prepare for the PredictionIO :
# yum -y install zip unzip
# cd /opt/
# wget http://download.prediction.io/PredictionIO-0.7.3.zip
# unzip PredictionIO-0.7.3.zip

Step: 13. Setting Up PredictionIO (Run the 3rd-party software setup script) :

# cd /opt/PredictionIO-0.7.3/bin
# sh setup-vendors.sh
   
Cannot find mongod from process list, search path, nor vendors area. Do you want to automatically install MongoDB 2.4.9? [y/n] y

Cannot find hadoop from search path nor vendors area. Do you want to automatically install Apache Hadoop 1.2.1? (Please make sure you can SSH to the localhost without a password.) [y/n] n

Step: 14. Make data & logs directory for PredictionIO :

# cd ..
# mkdir -p vendors/mongodb/data
# mkdir -p vendors/mongodb/logs
# vendors/mongodb-linux-x86_64-2.4.9/bin/mongod --config conf/mongodb/mongodb.conf >/dev/null 2>&1 &

Step: 15. Afterwards, Start all PredictionIO Services :

# cd /opt/PredictionIO-0.7.3/bin
# sh start-all.sh
       
Found MongoDB in vendors area. Do you want to start it? [y/n] y
   
Step: 16. Now Create a user For PredictionIO :

# cd /opt/PredictionIO-0.7.3/bin
# sh users
   
PredictionIO CLI User Management

1 - Add a new user
2 - Update email of an existing user
3 - Change password of an existing user
Please enter a choice (1-3): 1
Adding a new user

Email: kchatterjee@domain.com
Password: Passw0rd
Retype password: Passw0rd
First name: admin
Last name:
 
User added...

Step: 17. Now, you should be able to access PredictionIO :

http://192.168.72.140:9000

Step: 18. Install Apache Server :

# yum -y install httpd httpd-devel

Step: 19. Restart Apache Server :

# chkconfig httpd on
# service httpd restart
   
Step: 20. Make Reverse Proxy Setting for PredictionIO :

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

<VirtualHost *:80>

  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin support@domain.com
  ServerName 192.168.72.140
  # ServerAlias


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


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

</VirtualHost>

-- Save & Quit (:wq)
   
# vi /etc/httpd/conf.d/predictionio.domain.com.conf
   
<VirtualHost *:80>
  # Admin email, Server Name (domain name) and any aliases
  ServerAdmin support@domain.com
  ServerName www.predictionio.domain.com
  ServerAlias predictionio.domain.com
  ProxyRequests On
  ProxyPass / http://localhost:9000/
  ProxyPassReverse / http://localhost:9000/
</VirtualHost>

-- Save & Quit (:wq)

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

-- Find the Line & Uncomment :

NameVirtualHost *:80

-- Save & Quit (:wq)
       
# mkdir /logs
# service httpd restart
   
Step: 21. Now, Point your Web Browser :

http://predictionio.domain.com
User: admin
Pass: Passw0rd

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

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

 
Copyright © 2016 Kousik Chatterjee's Blog