Tuesday, June 8, 2010

Install DB2 Express-C in silent mode on Linux

This article teaches you the basics of how install, in silent mode and without X Server, DB2 Express-C with the support of the official guide and other authoritative documents.
  1. Copy the installation tar file (my favorite mode to do this is through WinScp and Putty) and login as root on server.
  2. Before start check if there are all prerequisites (they can have different names in other Linux distribution): compat-libstdc++, nfs-utils, libaio1, ksh, libstdc++5.
  3. Now, after you have unpacked the archive containing the installation files ("tar -xvf" and/or "gunzip"), run the following statement:
./db2_install
  1. As DB2 server has machine level authentication, now it's time to create every groups and users that we need:
Groups:
/usr/sbin/groupadd -g 999 db2iadm1
/usr/sbin/groupadd -g 998 db2fadm1
/usr/sbin/groupadd -g 997 dasadm1
/usr/sbin/groupadd -g 1000 db2dev

Users:
/usr/sbin/useradd -g db2grp1 -m -d /home/db2inst1 db2inst1 -p db2inst1
/usr/sbin/useradd -g db2fgrp1 -m -d /home/db2fenc1 db2fenc1 -p db2fenc1
/usr/sbin/useradd -g dasadm1 -m -d /home/dasusr1 dasusr1 -p dasusr1
/usr/sbin/useradd -g db2dev -m -d /home/db2user db2user –p db2user

It's necessary to verified the password:
passwd db2inst1
passwd db2fenc1
passwd dasusr1
passwd db2user
  1. Instance creation: db2icrt -a SERVER -p 50000 -s wse -u db2fenc1 db2inst1
  2. Das user creation: dascrt -u dasusr1
  3. Verify default shell used by DB2 users:
vi /etc/passwd

From:
db2inst1:x:1001:1001::/home/db2inst1:/bin/sh
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/sh
dasusr1:x:1003:1003::/home/dasusr1:/bin/sh

to:
db2inst1:x:1001:1001::/home/db2inst1:/bin/bash
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/bash
dasusr1:x:1003:1003::/home/dasusr1:/bin/bash
  1. Enabling remote administration as root user:
vi /etc/services

and add following lines:
ibm-db2 523/tcp # IBM DB2 DAS
ibm-db2 523/udp # IBM DB2 DAS
db2c_db2inst1 50000/tcp # IBM DB2 instance - db2inst1

as db2inst1 (instance administrator):
db2 update dbm cfg using SVCENAME db2c_db2inst1
db2set DB2COMM=tcpip
db2stop
db2start

and as dasusr1 (administration user):
db2admin stop
db2admin start


  1. Instance automatically startup, as db2inst1:
 db2set DB2AUTOSTART=YES

as root:
vi /etc/init.d/db2

and put following lines:
#!/bin/bash
#
# Script to start DB2 instances on bootup.
#
set -e
. /lib/lsb/init-functions
case "$1" in
start)
/opt/ibm/db2/version/instance/db2istrt
;;
stop|restart|reload)
;;
esac
exit 0
  1. Admin manager automatically startup:
as root:
vi /etc/rc.local

and put following lines:
su dasusr1 -c /home/dasusr1/script/startadmin.sh
exit 0

as dasusr1:
vi /home/dasusr1/script/startadmin.sh

and put following lines:
#!/bin/sh
# The following three lines have been added by UDB DB2.
if [ -f /home/dasusr1/das/dasprofile ]; then
. /home/dasusr1/das/dasprofile
fi
db2admin start

after:
chmod 777 /home/dasusr1/script/startadmin.sh

  1. Optimizing the Linux kernel by editing the configuration (/etc/sysctl.conf) through the rules of document "The DB2 UDB memory model" in DeveloperWorks, beautiful web site:
vi /etc/sysctl.conf

Example 64 bit achitecture with 2G of RAM (please look "Tuning and Monitoring Database System Performance" redbook):
kernel.sem=250 256000 32 1024
kernel.shmmni=4096
kernel.shmmax=1610612736
kernel.shmall=1932735283
kernel.msgmni=1024
kernel.msgmax=65536
kernel.msgmnb=65536

  1. Instance environment configuration, as db2inst1:
vi .bashrc

and put following lines:
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF' 
export PATH=/home/db2inst1/scripts:$PATH
export DB2CODEPAGE=1252

after:
vi /home/db2inst1/sqllib/db2profile

and put following lines:
export DB2CODEPAGE=1252 (or your code page)
and as root:
vi /etc/profile
and put following lines:
DB2INSTANCE=db2inst1
export DB2INSTANCE
INSTHOME=/home/db2inst1
export DB2CODEPAGE=1252

    No comments:

    Post a Comment