Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday, 7 May 2016

How To Install & Configure Percona XtraDB Cluster 5.6 on CentOS/RHEL 6x


How To Install Percona XtraDB Cluster 5.6 on CentOS/RHEL 6x


This Cluster will be assembled of Two (2) Servers/Nodes :

Node #1
Hostname: server1.centos.com
IP: 192.168.100.140

Node #2
Hostname: server2.centos.com
IP: 192.168.100.142

Prerequisites :
==========

1. All two Nodes have a CentOS 6.6 Installation.
2. Firewall has been set up to allow Connecting to Ports 3306, 4444, 4567 and 4568
3. SELinux is Disabled
4. MySQL should be Removed.

5. Configure Password-less Authentication (RSA/DSA) (Optional).

Installation :
=========
   
Step: 1. Make entry to the host file of each Server :

# vi /etc/hosts

192.168.100.140 server1.centos.com   server1
192.168.100.142 server2.centos.com   server2

-- Save & Quit (:wq)
   
Step: 2. Enable EPEL Repo and Percona Repo on your Server :

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
   
Step: 3. Install Dependency for Percona :

# yum install -y socat libaio* perl-DBD-MySQL  perl-Time-HiRes rsync wget
# wget --no-cache http://www.convirture.com/repos/definitions/rhel/6.x/convirt.repo -O /etc/yum.repos.d/convirt.repo
# yum makecache
   
Step: 4. Download the Packages on the Server :

# yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
# yum install -y Percona-XtraDB-Cluster-56
   
Step: 5. Configuring the Nodes :
   
On Node1 : i.e 192.168.100.140
========================
# vi /etc/my.cnf
   
[mysqld]
skip-host-cache
skip-name-resolve
max_connections=10000
max_connect_errors=200

datadir=/var/lib/mysql
user=mysql

# Path to Galera library
wsrep_provider=/usr/lib64/libgalera_smm.so

# Cluster connection URL contains the IPs of node#1, node#2
wsrep_cluster_address=gcomm://192.168.100.140,192.168.100.142

# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW

# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB

# This is a recommended tuning variable for performance
innodb_locks_unsafe_for_binlog=1

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2

# Node #1 Address
wsrep_node_address=192.168.100.140

# SST Method
wsrep_sst_method=xtrabackup

# Cluster Name
wsrep_cluster_name=my_centos_cluster

# Authentication for SST Method
wsrep_sst_auth="sstuser:s3cret"
wsrep_replicate_myisam=1

-- Save & Quit (:wq)
       
Step: 6. Start the first Node with the Following Command :
   
# /etc/init.d/mysql bootstrap-pxc

OR

# /etc/init.d/mysql start --wsrep-cluster-address="gcomm://"
   

Step: 7. Now, Login to MySQL and check the Cluster Status :

# mysql -u root

mysql> show status like 'wsrep%';


Step: 8. Change the MySQL root Password :

# mysql -u root
   
mysql> UPDATE mysql.user SET password=PASSWORD("redhat") where user='root';
mysql> FLUSH PRIVILEGES;

Step: 9. In order to perform Successful State Snapshot Transfer using XtraBackup new user Needs to be set up with proper Privileges :

# mysql -u root -p
Enter Password:

mysql> CREATE USER 'sstuser'@'localhost' IDENTIFIED BY 's3cret';
mysql> GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'sstuser'@'localhost';
mysql> FLUSH PRIVILEGES;
   
Note: MySQL root account can also be used for setting up the SST with Percona XtraBackup, BUT it's recommended to use a different (non-root) user for this.
   
Node 2 : i.e 192.168.100.142
======================

# vi /etc/my.cnf
   
[mysqld]
skip-host-cache
skip-name-resolve
max_connections=10000
max_connect_errors=200

# Path to Galera library
wsrep_provider=/usr/lib64/libgalera_smm.so

# Cluster connection URL contains IPs of node#1, node#2
wsrep_cluster_address=gcomm://192.168.100.140,192.168.100.142

# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW

# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB

# This is a recommended tuning variable for performance
innodb_locks_unsafe_for_binlog=1

# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2

# Node #2 address
wsrep_node_address=192.168.100.142

# Cluster name
wsrep_cluster_name=my_centos_cluster

# SST method
wsrep_sst_method=xtrabackup

# Authentication for SST method
wsrep_sst_auth="sstuser:s3cret"
wsrep_replicate_myisam=1

-- Save & Quit (:wq)

Now Start the Cluster on Node 2 :
       
# service mysql restart
# mysql -u root -p
Enter Password:

mysql> show status like 'wsrep%';

  















Testing :
======

A. Creating the new Database on the Node2 :

mysql> CREATE DATABASE test;

B. Creating the Example Table :

mysql> USE test;
mysql> CREATE TABLE example (node_id INT PRIMARY KEY, node_name VARCHAR(30));

C. Inserting Records on the Node1 :

mysql> INSERT INTO test.example VALUES (1, 'test1');

D. Retrieving all the Rows from that Table on the Node2 :

mysql> SELECT * FROM test.example;









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

Saturday, 30 April 2016

How to Install & Configure LAMP Server On Ubuntu 14.04


How to Install & Configure LAMP Server On Ubuntu 14.04
Step: 1. Bind Hosts File :

# vi /etc/hosts

192.168.1.250 ser1.domain.com    ser1

-- Save & Quit (:wq)

Step: 2. Install Apache2 Server :

# apt-get update
# apt-get -y install apache2 apache2-utils

<<<<<<How to Find your Server’s IP address>>>>>

# ifconfig eth0 | grep inet | awk '{ print $2 }'

Step: 3. Install MySQL Server :

# apt-get -y install mysql-server libapache2-mod-auth-mysql

Note: Once you have installed MySQL, we should activate it with this command :

# mysql_install_db

Step: 4. Set MySQL Root Password :

# mysql_secure_installation

# service mysql restart

Step: 5. Install PHP 5.5 :

# apt-get -y install php5 php5-dev libapache2-mod-php5 php5-mcrypt php5-mysql php5-cli \
   php5-common php5-curl php5-gd php5-imap php5-imagick php5-intl php5-ldap  \
   php5-memcache php5-memcached  php5-snmp php5-xcache php5-xmlrpc

# vi /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
          DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

-- Save & Quit (:wq)

Step: 6. Search PHP Modules (Optional) :

# apt-cache search php5-
# apt-get -y install php5-json

Step: 7. See PHP on your Server :

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

<?php
phpinfo();
?>

-- Save & Quit (:wq)

http://ip_address/info.php

Or

# php -v

Step: 8. Download & Install phpMyAdmin (To Access MySQL Server Graphically) :

# cd /var/www/html
# wget http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.10/phpMyAdmin-4.0.10-english.tar.gz
# tar -zxvf phpMyAdmin-4.0.10-english.tar.gz
# mv phpMyAdmin-4.0.10-english pma
# rm -rf phpMyAdmin-4.0.10-english.tar.gz
# cd pma/
# mv config.sample.inc.php config.inc.php

# service apache2 restart
# service mysql restart

Step: 9. Configure phpMyAdmin with MD5 Password Protected :

# vi /etc/apache2/sites-available/pma.domain.com.conf

<VirtualHost *:80>
  DocumentRoot /var/www/html/pma
  ServerName pma.anything.com
  # ServerAlias www.pma.domain.com

# Authorize for setup
<Directory /var/www/html/pma/setup>
    <IfModule mod_authn_file.c>
    AuthType Basic
    AuthName "phpMyAdmin Setup"
    AuthUserFile /home/secure/.htpasswd
    </IfModule>
    Require valid-user
</Directory>

<Directory /var/www/html/pma>
   Options All Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

-- Save & Quit (:wq)

# mkdir /home/secure/
# htpasswd -c /home/secure/.htpasswd pmaadmin

# cd /etc/apache2/sites-enabled/
# ln -s /etc/apache2/sites-available/pma.domain.com.conf pma.domain.com.conf
Or
# a2ensite  pma.domain.com

# service apache2 restart

http://pma.domain.com

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

Friday, 29 April 2016

Linux Tmux Vs Screen Command

Linux Tmux Vs Screen Command


Q. What is tmux ?

-- tmux is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.

Q. What is Screen ?

-- Screen is a full-screen software program that can be used to multiplexes a physical console between several processes (typically interactive shells). It offers a user to open several separate terminal instances inside a one single terminal window.

Step: 1. Install tmux :

# yum -y install epel-release
# yum -y install tmux

Step: 2. Install Screen :

# yum -y install screen

Tmux Vs Screen
Tmux Vs Screen
Tmux Vs Screen

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

Saturday, 23 April 2016

Easy Way to Install the MongoDB PHP Driver on CentOS/RHEL 6x & Ubuntu 14.04

Install the MongoDB PHP Driver on CentOS/RHEL 6x & Ubuntu 14.04

Step: 1. Install Apache Server :

For CentOS Users :

# yum -y install httpd httpd-devel

For Ubuntu Users :

# apt-get -y install apache2

Step: 2. Install PHP :

For CentOS Users :

# yum -y install epel-release
# yum -y install php php-cli 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-intl mod_ssl
 
For Ubuntu Users :

# apt-get -y install php5 php5-cli libapache2-mod-php5 php-pear php5-dev

Step: 3. Install Mongo Driver :

For CentOS Users :

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

For Ubuntu Users :

# pecl install mongo

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

For CentOS Users :

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

extension=mongo.so

-- Save & Quit (:wq)

For Ubuntu Users :

# vi /etc/php5/conf.d/mongo.ini

extension=mongo.so

-- Save & Quit (:wq)

Step: 5. Finally Restart the Apache Service :

For CentOS Users :

# service httpd restart

For Ubuntu Users :

# service apache2 restart

Step: 6. Now Create a info.php File Under /var/www/html & Check the Mongo Driver :

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

<?php
    phpinfo ();
?>

-- Save & Quit (:wq)

http://ip_address/info.php

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

Saturday, 16 April 2016

How To Use Iptables Rules For Linux

Iptables Rules For Linux

Q. What is iptables?

 -- It’s the basics of Firewall for Linux. Iptables is a rule based firewall system and it is normally pre-installed on a Unix operating system which is controlling the incoming and outgoing packets. By-default the iptables is running without any rules, we can create, add, edit rules into it.

Rule: 1. Block Specific IP Address in IPtables Firewall :

# iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP

Note: In case you only want to block TCP traffic from that IP address:

# iptables -A INPUT -p tcp -s xxx.xxx.xxx.xxx -j DROP

Rule: 2. Unblock IP Address in IPtables Firewall :

# iptables -D INPUT -s xxx.xxx.xxx.xxx -j DROP

Rule: 3. Block Specific Port on IPtables Firewall :

# iptables -A OUTPUT -p tcp --dport xxx -j DROP

Rule: 4. To Allow Incoming Connections use :

# iptables -A INPUT -p tcp --dport xxx -j ACCEPT

Rule: 5. Allow Multiple Ports on IPtables using Multiport :

# iptables -A INPUT  -p tcp -m multiport --dports 22,80,443 -j ACCEPT
# iptables -A OUTPUT -p tcp -m multiport --sports 22,80,443 -j ACCEPT

Rule: 6. Allow Specific Network Range on Particular Port on IPtables :

# iptables -A OUTPUT -p tcp -d 192.168.100.0/24 --dport 22 -j ACCEPT

Rule: 7. Block Facebook on IPtables Firewall :

# host facebook.com
facebook.com has address 66.220.156.68

# whois 66.220.156.68 | grep CIDR
CIDR: 66.220.144.0/20

# iptables -A OUTPUT -p tcp -d 66.220.144.0/20 -j DROP

Rule: 8. Setup Port Forwarding in IPtables :

# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25 -j REDIRECT --to-port 2525

Rule: 9. Block Network Flood on Apache Port with IPtables :

# iptables -A INPUT -p tcp --dport 80 -m limit --limit 100/minute --limit-burst 200 -j ACCEPT

Rule: 10. Block Incoming Ping Requests on IPtables :

# iptables -A INPUT -p icmp -i eth0 -j DROP

Rule: 11. Allow loopback (127.0.0.1) Access :

# iptables -A INPUT -i lo -j ACCEPT
# iptables -A OUTPUT -o lo -j ACCEPT

Rule: 12. Block Access to Specific MAC Address on IPtables :

# iptables -A INPUT -m mac --mac-source 00:00:00:00:00:00 -j DROP

Rule: 13. Limit the Number of Concurrent Connections per IP Address :

# iptables -A INPUT -p tcp --syn --dport 22 -m connlimit --connlimit-above 3 -j REJECT

Rule: 14. Setup IPtables Rules for PCI Compliance :

# iptables -I INPUT -d SITE -p tcp -m multiport --dports 21,25,110,143,465,587,993,995 -j DROP

If you use cPanel or similar control panel, you may need to block it’s’ ports as well. Here is an example:

# iptables -I in_sg -d DEDI_IP -p tcp -m multiport --dports  2082,2083,2095,2096,2525,2086,2087 -j DROP

Rule: 15. Block Connection on Network Interface :

# iptables -A INPUT -i eth0 -s xxx.xxx.xxx.xxx -j DROP

Rule: 16. Disable Outgoing Mails through IPTables :

# iptables -A OUTPUT -p tcp --dports 25,465,587 -j REJECT

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

Thursday, 14 April 2016

How To Install PHP 7 on CentOS/RHEL 6x

Install PHP 7 on CentOS/RHEL 6x


Step: 1. You must add the Webtatic & EPEL yum Repository :

For CentOS/RHEL 7.x :

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x :

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

Step: 2. Now you can install PHP 7.0 (along with an opcode cache) by doing :

# yum install -y --enablerepo=webtatic-testing php70w php70w-opcache php70w-bcmath php70w-cli php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mysql php70w-mysqlnd php70w-odbc php70w-pdo php70w-pdo_dblib php70w-pgsql php70w-process php70w-pspell php70w-recode php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc --skip-broken

Step: 3. Changes on the Module File for Php :

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

-- Line no. 6 & 10 replace with these Lines.

LoadModule php7_module modules/libphp7.so (replace with line nuber 6)
LoadModule php7_module modules/libphp7-zts.so (replace with line number 10)
AddHandler php7-script .php (replace with line number 16)

-- Save & Quit (:wq)

Step: 4. Create a php info file & Check :

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

<?php
  phpinfo ();
?>

-- Save & Quit (:wq)

# service httpd restart

Check on Browser http://IP-Address/info.php

or Check through CLI :

# php -v

PHP 7.0.0RC2 (cli) (built: Sep  4 2015 21:04:20)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
   
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog

Friday, 8 April 2016

MySQL Important Useful Commands

MySQL Important Useful Commands

MySQL Important Useful Commands:

1. MySQL Dump For Single Database :

#
mysqldump --force --opt --single-transaction --lock-tables=false --skip-events --user=root --password=password --routines --databases shockable > /tmp/shockable.sql

2. MySQL Dump For All Databases :

#
mysqldump --force --opt --single-transaction --lock-tables=false --skip-events --user=root --password=password --routines --all-databases > /tmp/all_backups.sql

3. Restore Database from MySQL Dump :

#
mysql -u root -ppassword < /tmp/all_backups.sql

4. Restore a Single Database from All_Databases :

#
mysql -u root -p --one-database destdbname < /tmp/all_databases.sql

5. Backup A Single Table (Table Name: users) :

#
mysqldump -u root -ppassword database_name users > /tmp/users.table.sql

6. Restore that Table :

mysql>
create database database_name;
mysql>
exit

#
mysql -u root -ppassword database_name < /tmp/users.table.sql

7. MySQL Ignore Table :

#
mysqldump -u username -ppasswword --ignore-table=dbname.tablename dbname > /tmp/dbname.sql

8. Show MySQL Database size:

#
mysql -u root -p
Enter the Password:

SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;

OR
SELECT 'Total DB Size' SizeInMB,
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB"
FROM information_schema.TABLES
where table_schema not in ('mysql','information_schema');


9. To view individual Database Size in MySQL :

#
mysql -u root -p
Enter the Password:

SELECT table_schema                                        "DB Name",
   Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM   information_schema.tables
GROUP  BY table_schema;

OR
SELECT table_schema,
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB"
FROM information_schema.TABLES
where table_schema not in ('mysql','information_schema','performance_schema')
group by table_schema
order by 2 desc;


10. MySQL Cluster Status :

#
mysql -u root -p
Enter the Password:

mysql> show status like 'wsrep%';

11. To Check MySQl Cluster is Synced or Not :
# /usr/bin/clustercheck root root_password

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

 

Tuesday, 29 March 2016

Install & Configure AWS API Tool on EC2 Instance

Install & Configure AWS API Tool on EC2 Instance
Q. What is AWS API Tool ?


 Ans: The API tools serve as the client interface to the Amazon EC2 web service. You can use the CLI tools to manage your Amazon EC2 resources (such as instances, security groups, and volumes) and your Amazon VPC resources (such as VPCs, subnets, route tables, and Internet gateways).

Step: 1. Install Java :

# yum -y install java-1.7.0-openjdk
# export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
# java -version

Step: 2. Download & Unzip Amazon EC2 CLI Tools :

# yum -y install wget zip unzip
# cd /tmp
# wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
# unzip ec2-api-tools.zip

Step: 3. Install the Amazon EC2 CLI Tools :

# mkdir /usr/local/ec2
# mv ec2-api-tools-1.7.5.0 /usr/local/ec2/apitools/

Step: 4. Set Variables :

# export EC2_HOME=/usr/local/ec2/apitools
# export PATH=$PATH:$EC2_HOME/bin

Step: 5. Add variables to Startup Script :

# cd /etc/profile.d/
# vi aws.sh

export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
export EC2_HOME=/usr/local/ec2/apitools
export PATH=$PATH:$EC2_HOME/bin

-- Save & Quit (:wq)


# chmod +x aws.sh
# source aws.sh

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

Friday, 25 March 2016

How to Install Tomcat 9 With Java 9 On CentOS/RHEL 6x


How to Install Tomcat 9 With Java 9 On CentOS/RHEL 6x

 
 Q. What is Apache Tomcat ?

Ans: Tomcat is an open source application server from the Apache Software Foundation that executes Java servlets and renders Web pages that include Java Server Page coding.

Step: 1. Bind the Hosts File :

# vi /etc/hosts

192.168.72.220    ser1.kmi.com    ser1

-- Save & Quit (:wq)

Step: 2. Stop the IPTables & Selinux :

# service iptables stop
# chkconfig iptables off

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

Step: 3. Update the Date Time on the Server :

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

Step: 4. Reboot the System :

# init 6

Step: 5. Download & Install Java 9 :

# cd /opt
# wget http://download.java.net/java/jdk9/archive/104/binaries/jdk-9-ea+104_linux-x64_bin.tar.gz
# tar -zxvf jdk-9-ea+104_linux-x64_bin.tar.gz
# cd jdk-9/
# alternatives --install /usr/bin/java java /opt/jdk-9/bin/java 2
# alternatives --config java

There may Be more that 1 programs which provide 'java'. Select the version Which is downloaded.

Selection    Command
-----------------------------------------------
*  1           /opt/jdk1.7.0_71/bin/java
 + 2           /opt/jdk1.8.0_45/bin/java
   3           /opt/jdk1.8.0_66/bin/java
   4           /opt/jdk-9/bin/java
  
Enter to keep the current selection[+], or type selection number: 4

# alternatives --install /usr/bin/jar jar /opt/jdk-9/bin/jar 2
# alternatives --install /usr/bin/javac javac /opt/jdk-9/bin/javac 2
# alternatives --set jar /opt/jdk-9/bin/jar
# alternatives --set javac /opt/jdk-9/bin/javac

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

#!/bin/bash
JAVA_HOME=/opt/jdk-9/
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

Step: 6. Check the Installed Java Version :

# java -version

java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+104-2016-02-03-214959.javare.4385.nc)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+104-2016-02-03-214959.javare.4385.nc, mixed mode)

Step: 7. Download & Install Tomcat 9 :

# cd /opt
# wget http://www.us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M3/bin/apache-tomcat-9.0.0.M3.tar.gz
# tar -zxvf apache-tomcat-9.0.0.M3.tar.gz
# mv apache-tomcat-9.0.0.M3 /usr/local/tomcat9

Step: 8. Create a init Script for run the Tomcat as a Service :

# vi /etc/init.d/tomcat

#!/bin/bash
# description: Tomcat Start Stop Restart-SOM
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/opt/jdk-9
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/usr/local/tomcat9

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

-- Save & Quit (:wq)

# chmod 755 /etc/init.d/tomcat

Step: 9. Manage Tomcat Manager & Admin Panel :

# vi /usr/local/tomcat9/conf/tomcat-users.xml

### Add these lines in between "<tomcat-users>" Tag. Change the Password & User Name.

<role rolename="manager-gui" />
<user username="manager" password="redhat" roles="manager-gui" />

<role rolename="admin-gui" />
<user username="admin" password="redhat" roles="manager-gui,admin-gui" />

-- Save & Quit (:wq)

Step: 10. Start the Tomcat Service :

# service tomcat restart
# chkconfig tomcat on

Step: 11. Check on Web Browser :

http://<IP_Address>:8080

Click on Manager App & Login with Manager Creds
Click on Host Manager & Login with Admin Creds

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

Thursday, 17 March 2016

Take Backup of Windows Web Server Using Batch Script

Take Backup of Windows Web Server Using Batch Script

One of the most common, and well suited, applications for a command line script is data backup. Command line scripts can be automated to run at any time without any human interaction.

Requirements:

Windows 2000/XP/2003/Win7/2008/2012
7-Zip (it’s free).

Open Notepad or Notepad++ & Paste the Bellow Code :

set TIMESTAMP=%DATE:~7,2%-%DATE:~4,2%-%DATE:~10,4%-%TIME:~0,2%%TIME:~3,2%%TIME
:~6,2%
cd C:\WebBackup\www_backup\
md "%TIMESTAMP%"
ECHO %TIMESTAMP% > "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
ECHO "Backup of My Websites" >> "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
cd C:\www\
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.7z" "%%X\" >> "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
move C:\www\*.7z C:\WebBackup\www_backup\%TIMESTAMP%\ >> "C:\WebBackup\backuplog\www_%TIMESTAMP%.log"
exit

-- Save the File with .bat Extension. (Ex: MyScript.bat)

Here, My Web File Location is "C:\www\" & My Web File Backup Location is "
C:\WebBackup\www_backup\"


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


Tuesday, 15 March 2016

How To Install & Configure Zpanel on Centos/RHEL 6x

How To Install & Configure Zpanel on Centos/RHEL 6x

Q. What is Zpanel ?

Ans: ZPanel is a free and complete web hosting control panel for Microsoft® Windows™ and POSIX (Linux, UNIX and MacOSX) based servers. ZPanel is written in PHP and uses several open-source (or freely available) software packages to provide a secure, web hosting system.

Step: 1. Disable Selinux & Iptables :

# vi /etc/sysconfig/selinux

SELINUX=disabled

-- Save & Quit (:wq)

# service iptables stop
# chkconfig iptables off

Step: 2. Download the correct Installer for your System :

# cd /tmp
# wget http://www.zvps.co.uk/downloads/centos/10-1-0/updater-10-1-0-centos-64.sh.x.tar.gz
# tar -xf updater-10-1-0-centos-64.sh.x.tar.gz

Step: 3. Install pre-required Packages :

# yum -y install ld-linux.so.2 curl

Step: 4. Change the Script to be Executable :

# chmod +x updater-10-1-0-centos-64.sh.x
# ./installer-10-1-0-centos-64.sh.x

Set Time Zone : Asia/Kolkata
Enter -> Enter -> Enter.

Note: The Zadmin, MySQL root & postfix passwords are all stored in /root/passwords.txt after installation.

Lastly run the following command to fix the zpanel stored IP (broken api call) REPLACE 0's with your actual public IP:

# setso --set server_ip 000.000.000.000

Step: 5. Open Your Web Browser & Type :

http://192.168.72.140

MySQL Root Password    : 0lENKKZ4zOKO4qcD
MySQL Postfix Password : eyiF5v0emD5tYDnB
ZPanelX Username       : zadmin        
ZPanelX Password       : L6XOGulJj1JeoqYR

Step: 6. To Change Zpanel Admin Password :

Go to Account Information -> Change Password -> Type Current Password & New Password -> Change.

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

Copyright © 2016 Kousik Chatterjee's Blog