Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

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

Sunday 13 March 2016

How to Install Bitcoin XT node on Ubuntu Server 14.04 LTS

How to Install Bitcoin XT node on Ubuntu Server 14.04 LTS

Q. What is Bitcoin ?

Ans: Bitcoin is digital currency in which encryption techniques are used to regulate the generation of units of currency. In 2009 by an unknown person using the alias Satoshi Nakamoto. It is the first decentralized peer-to-peer payment network that is powered by its users with no central authority or middlemen – meaning, no banks! No one controls it. There are no transaction fees and no need to give your real name.

OS: Ubuntu Server 14.04 LTS
Minimum HDD Size: 120 GB
Minimum RAM:  3.5 GB
CPU: 2 Cores

Step: 1. Install Prerequisites :

# apt-get update
# apt-get -y install python-software-properties
# apt-get -y install build-essential libboost-all-dev automake libtool autoconf
# apt-get -y install libdb++-dev
# apt-get -y install libboost-all-dev
# apt-get -y install pkg-config
# apt-get -y install libssl-dev
# apt-get -y install libcurl4-openssl-dev
# apt-get -y install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
# apt-get -y install git

Step: 2. Install BitcoinXT :

# cd
# git clone https://github.com/bitcoinxt/bitcoinxt
# cd bitcoinxt
# ./autogen.sh
# ./configure --with-cli=yes --with-gui=no --disable-wallet
# make
# make install

Step: 3. We will Run bitcoind once so it Generates the proper Directories :

# bitcoind -server

Step: 4. Configure BitcoinXT :

# echo 'rpcuser=bitcoinrpc' > ~/.bitcoin/bitcoin.conf   (Default Bitcoin XT User)
# echo 'rpcpassword=6Q9k65HhrgA1ghY1chr2x4776AwEkkf1eH5eZ7Fh7dXk' >>  ~/.bitcoin/bitcoin.conf  (Default Bitcoin XT Password)
# echo 'server=1' >>  ~/.bitcoin/bitcoin.conf

Step: 5. Verify config-file Values are in the file :

# cat ~/.bitcoin/bitcoin.conf

Step: 6. To Check this has Worked perform the Following :

# cd ~/.bitcoin
# ls -al

"blocks" should be in a cyan colour and look like this: blocks -> /media/data/blocks Node that it's the current user, bitcoin, that has file access.

Step: 7. The Daemon should now be ready to Start :

# bitcoind -daemon

Step: 8. Type the Following to run a Small Test :

# bitcoin-cli getinfo

The output should be something like this :

{
    "version" : 110000,
    "protocolversion" : 70010,
    "blocks" : 90012,
    "timeoffset" : -1,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 3091.73689041,
    "testnet" : false,
    "relayfee" : 0.00001000,
    "errors" : ""
}

Step: 9. Also, go to https://getaddr.bitnodes.io/ & type in the node network address. ex: 192.168.72.10 & click "CHECK NODE".

Something like the following should show to verify you are running BitcoinXT:

192.168.72.10:8333 /Bitcoin XT:0.11.0/

Step: 10. To Check Block Chain :

https://blockchain.info/

# bitcoin-cli getblockcount

Step: 11. To Check BitcoinXT Version :

# bitcoind -version

Bitcoin XT Daemon version v0.11.0.0-fa6040a
Copyright (C) 2009-2015 The Bitcoin XT Developers

Step: 12. To Check Debug Log files :

# tail -100f ~/.bitcoin/debug.log

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

Wednesday 9 March 2016

How to Install & Configure Prestashop On RHEL/Centos 6x

How to Install & Configure Prestashop On RHEL/Centos 6x


Q. What is Prestashop ?

Ans: PrestaShop is a free, open source e-commerce solution. It supports payment gateways such as DirecPayDirecPay,Google Checkout, Authorize.Net, Skrill, PayPal and PayPal Payments Pro via their respective APIs.


Step: 1. Install Apache Server & Dependency :


# yum -y install httpd httpd-devel zip unzip wget

Step: 2. 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: 3. Download & Configure PrestaShop :

# cd /var/www/html
# wget https://prestashop.googlecode.com/files/prestashop_1.5.6.2.zip
# unzip prestashop_1.5.6.2.zip

# chmod -Rf 777 /var/www/html/prestashop


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

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

Add those Lines :

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

-- Save & Quit (:wq)


Step: 5. Install MySQL Database Server :

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

Step: 6. Start MySQL Service :

# service mysqld start

Step: 7. Changing MySQL Root Password :

# mysql_secure_installation

Press Enter --> Y --> Give the Root Password --> Enter --> n --> Enter --> n --> Enter --> n --> Enter.

Step: 8. Create Database for PrestaShop :

# mysql -u root -p

-- Give root Password.

Mysql> create database prestashop character set utf8;
Mysql> grant all privileges on prestashop.* to 'presta'@'localhost' identified by 'password';
Mysql> grant all privileges on prestashop.* to 'presta'@'%' identified by 'password';
Mysql> flush privileges;
Mysql> exit

Step: 9. Install PHP5 Scripting Language :

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

Step: 10. Create a file named /var/www/html/info.php :

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

<?php
  phpinfo();
?>

-- Save & Quit (:wq)

Step: 11. Restart Apache to load php :

# service httpd restart
# chkconfig httpd on
# service mysqld restart
# chkconfig mysqld on

Step: 12. Then point your browser to http://ip address/info.php :

Ex- http://192.168.72.140/info.php

Step: 13. Configure PrestaShop Server :


Go to http://192.168.72.140/prestashop

Select Language: English -> Next -> I Agree -> Next -> Shop Name: server1.kmi.com, Main activity: Select anything, Country: Select Country, First Name: Koushik, Last Name: Chatterjee, Email Address: your-email@domain.com, Shop Password: Password, Re-type to confirm: Password -> Next -> Database Server Add: localhost, DB Name: prestashop, DB Login: presta, DB Password: password -> Next.

# cd /var/www/html/prestashop
# rm -rf install

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

Sunday 28 February 2016

How To Configure Wordpress on CentOS/RHEL 6x

How To Configure Wordpress on CentOS/RHEL 6x


Q. What Is WordPress?

Ans: WordPress is an open source and free blogging application and a dynamic CMS (Content Management System) developed using MySQL and PHP.

Step: 1. Install Apache Server :

# yum -y install httpd httpd-devel

Step: 2. Install & Configure Mysql Server :

# yum -y install mysql mysql-server

# service mysqld restart
# chkconfig mysqld on

# mysql_secure_installation (To Set Root Password for Mysql)

Step: 3. Create "wordpress" Database :

# mysql -u root -predhat

mysql> create database wordpress character set utf8 collate utf8_bin;
mysql> grant all privileges on wordpress.* to wordpress@'localhost' identified by 'password';
mysql> flush privileges;
mysql> exit

Step: 4. Install PHP :

# 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-intl mod_ssl

Step: 5. Downloading WordPress Package :

# cd /var/www/html
# wget http://wordpress.org/latest.tar.gz
# tar -xvzf latest.tar.gz

Step: 6. Configure Wordpress :

# cd wordpress
# cp wp-config-sample.php wp-config.php
# vi wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

-- Give DB_NAME (wordpress)

/** MySQL database username */
define('DB_USER', 'username_here');

-- Give DB_USER (wordpress)

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

-- Give DB_PASSWORD (password)

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

-- Save & Quit (:wq)

Step: 7. Creating Apache VirtualHost for WordPress :

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

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

-- Save & Quit (:wq)

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

Add The Following Lines :

Alias /wordpress /var/www/html/wordpress

<Directory /var/www/html/wordpress>
  AllowOverride Options
  <IfModule mod_authz_core.c>
    # Apache 2.4
    Require local
  </IfModule>
  <IfModule !mod_authz_core.c>
    # Apache 2.2
    Order Deny,Allow
    Deny from All
    Allow from all
    Allow from ::1
 </IfModule>
</Directory>

<Directory /var/www/html/wordpress/wp-content/plugins/akismet>
  <FilesMatch "\.(php|txt)$">
    Order Deny,Allow
    Deny from all
  </FilesMatch>
</Directory>

-- Save & Quit (:wq)


Step: 8. Restart the Apache Service :

# service httpd restart
# chkconfig httpd on

Step: 9. Finishing WordPress Installation :

http://192.168.72.139/wordpress

Give your Site Title, Create Admin User, Create Admin Password, Enter Your E-Mail and then click on Install button.

Click on Login -> Enter your WordPress Login details.

User: admin
Password: Passw0rd

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

Thursday 25 February 2016

How To Install & Configure rssh on CentOS/RHEL 6x

How To Install & Configure rssh on CentOS/RHEL 6x

Q. What is rssh ?

Ans: rssh is a restricted shell for use with OpenSSH, allowing only scp or sftp. It now also includes support for rdist, rsync, & cvs. For example, if you have a server which you only want to allow users to copy files off of via scp, without providing shell access, you can use rssh to do that.rssh is a Restricted Shell for Providing Limited Access to a host via ssh, it allows following Operations only :

1. scp - Secure file copy
2. sftp - Secure FTP
3. cvs - Concurrent Versions System ~ you can easily retrieve old versions to see exactly which change caused the bug
4. rsync - Backup & sync file system
5. rdist - Backup / RDist program maintains identical copies of files on multiple hosts.

Step: 1. Install rssh :

For CentOS :

# cd /tmp
# wget http://dag.wieers.com/rpm/packages/rssh/rssh-2.3.2-1.2.el5.rf.i386.rpm
# yum -y install rssh-2.3.2-1.2.el5.rf.i386.rpm

For Ubuntu :

# apt-get -y install rssh

Step: 2. Grant Access to SFTP & SCP for all Users by Appending :

Note: By default rssh locks down everything including any sort of access.

# vi /etc/rssh.conf

Uncommented:

allowscp
allowsftp

-- Save & Quit (:wq)

Step: 3. Restart the SSHD Service :

# service sshd restart

Step: 4. Create A New User with "/usr/bin/rssh" shell :

# useradd -m -d /var/www/html/koushik.com -s /usr/bin/rssh koushik
# passwd koushik

New password:
Retype new password:

Step: 5. Change User's Shell bash to rssh :

# usermod -s /usr/bin/rssh user_name
or
# chsh -s /usr/bin/rssh user_name

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

Monday 22 February 2016

How To Install Wetty (WEB+TTY) on RHEL/Centos 6x

How To Install Wetty (WEB+TTY) on RHEL/Centos 6x

Q. What is Wetty (Web + tty) ?

Ans: Terminal over HTTP and HTTPS. Wetty is an alternative to ajaxterm/anyterm but much better than them because wetty uses ChromeOS' terminal emulator (hterm) which is a full fledged implementation of terminal emulation written entirely in Javascript. Also it uses websockets instead of Ajax and hence better response time.

Step: 1. Install EPEL Repo :

# yum -y install epel-release

Step: 2. Install Wetty Dependencies :

# yum clean all
# yum -y install git nodejs npm screen
# yum groupinstall "Development Tools"
# npm -g update

Step: 3. Install NTP (Time Synchronization) :

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

Step: 4. After Installing these Dependencies, Clone the Wetty GitHub Repository :

# cd /root
# git clone https://github.com/krishnasrinivas/wetty

Step: 5. Install Wetty :

# cd wetty
# npm install pty.js
# npm install

Step: 6. Starting Wetty & Access Linux Terminal from Web Browser :

# node app.js -p 8080 (Port no.)

http://Your_IP-Address:8080

Step: 7. Run Wetty through HTTPS :

# cd /root/wetty
# openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes

Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:West Bengal
Locality Name (eg, city) [Default City]:Siliguri
Organization Name (eg, company) [Default Company Ltd]:TechnoMedia
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:ser1.techno.com
Email Address []:your_email@techno.com

Step: 8. Launch Wetty via HTTPS :

# screen
[Just Press Enter]

# cd /root/wetty
# node app.js --sslkey key.pem --sslcert cert.pem -p 8080

Step: 9. Add an User for Wetty :

# useradd koushik
# passwd koushik

New password: redhat
Retype new password: redhat

# vi /etc/sudoers

koushik    ALL=(ALL)    NOPASSWD:ALL

-- Save & Quit (:wq!)

Step: 10. Access Wetty Through Web Browser :

https://Your_IP-Address:8080
User: koushik
Pass: redhat

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

Friday 19 February 2016

How to Configure Linked Server with MySQL

How to Configure Linked Server with MySQL



Q. What is Linked Server?
Ans: Linked Servers allows you to connect to other database instances on the same server or on another machine or remote servers. It allows SQL Server to execute SQL scripts against OLE DB data sources on remote servers using OLE DB providers. The remote servers can be SQL Server, Oracle, MySQL etc. which means those databases that support OLE DB can be used for linking servers.

Scenario:

MySQL Server IP: 192.168.72.220
-- DB_Name: reportsdb
-- DB_User: reports
-- DB_Pass: redhat

Windows Server 2012 R2 IP: 192.168.72.226
-- Install MSSQL Server 2012 with SSMS
-- Download & Install ODBC Driver for MySQL to Connect from SQL Server.
 Link: http://cdn.mysql.com//Downloads/Connector-ODBC/5.3/mysql-connector-odbc-5.3.4-winx64.msi
  
Step: 1. Create Database & User on MySQL Server (192.168.72.220):

mysql> create database reportsdb;
mysql> grant all privileges on reportsdb.* to reports@'localhost' identified by 'redhat';
mysql> grant all privileges on reportsdb.* to reports@'%' identified by 'redhat';
mysql> flush privileges;

mysql> use reportsdb;
mysql> create table report1(name char(20));
mysql> insert into report1 values('koushik');
mysql> insert into report1 values('koushik1');

mysql> show tables;
+-------------------+
| Tables_in_report1  |
+-------------------+
| reports1                 |
+-------------------+
1 row in set (0.00 sec)

mysql> select * from reports1;

+-----------+
| name         |
+-----------+
| koushik1    |
| koushik      |
+-----------+
2 rows in set (0.00 sec)

mysql> flush privileges;
mysql> exit


Step: 2. Download & Install ODBC Driver for MySQL to Connect from SQL Server :

Link: https://dev.mysql.com/downloads/connector/odbc/5.1.html

For Windows Server 2008/2012 :
Link: http://cdn.mysql.com//Downloads/Connector-ODBC/5.3/mysql-connector-odbc-5.3.4-winx64.msi

Step 3. MySQL ODBC Connector Configuration :

Open Run --> odbcad32.exe --> System DNS (tab) & Click on Add -> Select MySQL ODBC 5.3 Driver --> Finish -> On MYSQL Connector Provide the Details of the Database that you are Trying to Connect.

Data Source Name: REPORTSMYSQL
DESCRIPTION: REPORTSMYSQL
TCP/IP SERVER: 192.168.72.220
USER: reposts
Password: redhat
Database: reportsdb

-- Test. (If Everything is Good it'll Showing Message: "Connection Success") --> Click "OK".
--> Click "OK" --> Again Click "OK"

Note: MySQL ODBC Connector Configuration has been done.

Method 1 :

Step: 3. Configure Linked Server :

-- Run the Following Query in SQL Server (SSMS). Change the Following Field :

1. DRIVER, 2.SERVER, 3.DATABASE, 4.USER, & 5. PASSWORD.

/****** Object: LinkedServer [REPORTSMYSQL] Script Date: 02/08/2016 16:34:21 ******/

EXEC master.dbo.sp_addlinkedserver @server = N'REPORTSMYSQL', @srvproduct=N'REPORTSMYSQL', @provider=N'MSDASQL', @provstr=N'DRIVER={MySQL ODBC 5.3 Driver}; SERVER=192.168.72.220;DATABASE=reportsdb; USER=reports; PASSWORD=redhat;option=3'

/* For security reasons the linked server remote logins password is changed with ######## */
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'REPORTSMYSQL',@useself=N'True',@locallogin=NULL,@rmtuser=NULL,
@rmtpassword=NULL
GO

EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'dist', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'pub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'rpc', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'rpc out', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'sub', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'connect timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'collation name', @optvalue=null
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'lazy schema validation', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'query timeout', @optvalue=N'0'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'use remote collation', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'REPORTSMYSQL', @optname=N'remote proc transaction promotion', @optvalue=N'true'
GO

-- Execute.

or Method 2 :

-- Login to SSMS Console.
-- Expand "Server Object" -->  Right Click on "Linked Servers" --> Click on "New Linked Server" --> Then Do the Following (For Example) :

Linked Server: REPORTSMYSQL
Server Type: Other Data Source
Provider: Microsoft OLE DB Provider for ODBC Drivers
Product Name: REPORTSMYSQL
Data Source: REPORTSMYSQL
Provider String: DRIVER={MySQL ODBC 5.3 Driver};SERVER=192.168.72.220;PORT=3306;DATABASE=reportsdb; USER=reports; PASSWORD=redhat;option=3;

--> Click on "OK"

Step: 4. Verify the Connection :

Connect to SSMS --> Server Objects --> Linked Server --> TESTMYSQL.

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

Saturday 13 February 2016

How to Install .NET Framework 3.5 on Windows Server 2012 and Windows Server 2012 R2


How to Install .NET Framework 3.5 on Windows Server 2012 and Windows Server 2012 R2


Step: 1. Command Line :

-- Insert the Windows Sever 2012 installation media.
-- Open Command Prompt as Administrator.
-- Execute the following command:

C:\Windows\system32> dism /Online /Enable-Feature /FeatureName:NetFX3 /All /Source:D:\Sources\SxS\ /LimitAccess

Step: 2. GUI Mode :

-- Insert the Windows Sever 2012 installation media.
-- Open Server Manager.
-- On the Add Roles and Features wizard, click on "Specify an alternate source path".
-- Enter D:\Sources\SxS\ to point to the Server 2012.
-- Click OK.


Note: Once done installing through the GUI or command prompt, if you navigate back to the Add Roles and Features Wizard, you should see the feature has been successfully installed now.

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

Copyright © 2016 Kousik Chatterjee's Blog