Friday, January 11, 2013

Installing DB2 9.1 64-bit on CentOS 6 64-bit

Untar the installer

tar xvf DB2_Enterprise_Svr_Ed_Linux_x86-64.tar

 

If you wish to do a graphic install and are connecting via a SSH client like ‘Putty’, you need to install and configure a 'X' server like ‘Xming’. Simply launch it listening on display 0.0 and turn off access control. On the remote server where we would start the setup, export ‘DISPLAY’ variable to point to your local machine

export DISPLAY=local_machine_dns_name_or_ip:0.0

Now if you run any X application it should open a screen on your machine. Try running ‘xclock’. If ‘xclock’ is not installed do

yum install xclock

Also, for simplicity (and assuming we are installing for development purposes) you may turn off the 'iptables' firewall to allow access to the DB2 database server we will install
service iptables stop
service iptables save

If you followed the instructions for setting up the X server and have it listening for clients on your local machine, do this to redirect X applications

export DISPLAY=machine_name:0.0

The only extra dependency I had to install to run the DB2 setup was this

yum install compat-libstdc++

Now you can run

./db2setup

This should start the installer and open the window on your local machine. Choose default choices for all options - DB2 Administration server under user dasusr1, port 523, DB2 instance under db2inst1, port 50000 etc

Once the setup is complete, login as db2inst1 and run

db2start

to start the server. To create a database run

db2

which gives you a prompt. Now you can create a sample database

db2 => create database sample

To test locally, simply connect to the sample database and you should see the below

db2 => connect to sample


   Database Connection Information

Database server        = DB2/LINUXX8664 9.1.0
SQL authorization ID   = DB2INST1
Local database alias   = SAMPLE

 

Connecting remotely

To test and connect remotely, install any DB2 client that includes ‘Command Line Processor’ (for example, DB2 9.5 Data Server Runtime Client. Assuming ‘ganga’ is the hostname for our DB2 server listening on port 50000, catalog the node as ‘ganga_n’

db2 => catalog tcpip node ganga_n remote ganga server 50000
DB20000I  The CATALOG TCPIP NODE command completed successfully.
DB21056W  Directory changes may not be effective until the directory cache is
refreshed.

Assuming there is a ‘sample’ database on server catalog it locally as ‘ganga_s’

db2 => catalog database sample as ganga_s at node ganga
DB20000I  The CATALOG DATABASE command completed successfully.
DB21056W  Directory changes may not be effective until the directory cache is
refreshed.

Now, you can connect to the remote ‘sample’ database. Assuming the instance was created as user ‘db2inst1’ (password ‘password) we can connect this way

db2 => connect to ganga_s user db2inst1 using password

   Database Connection Information

Database server        = DB2/LINUXX8664 9.1.0
SQL authorization ID   = DB2INST1
Local database alias   = GANGA_S

1 comment: