Installing IBM DB2 Version 7.2


Install libncurses.so.4

DB2 7.2 requires libncurses.so.4. Many older distributions come with libncurses.so.4. Many newer distributions come with libncurses.so.5 (or newer). Some distributions come with both. If your distribution does NOT have libncurses.so.4, create a symbolic link to the newer library as follows.

(These instructions assume that your system has ncurses version 5.2 and that libncurses.so.5.2 resides in /usr/lib. If your system has a different version of ncurses or if it resides somewhere else (for example, in /lib) then modify the instructions accordingly)

cd /usr/lib
ln -s libncurses.so.5.2 libncurses.so.4
Install Compatibility Packages

DB2 V7.2 for Linux requires glibc 2.1. Many newer Linux distributions come with glibc 2.2. On these distributions it is necessary to install some compatibility packages.

Distributions that come with glibc 2.1 include RedHat 6, Debian 2.2, Mandrake 7 and Slackware 7. Newer distributions come with newer versions of glibc.

RedHat provides compatability RPM's for RedHat 7 that can actually be used on any Linux distribution. These RPM's can be downloaded from rpmfind. You'll need the following RPM's.

You can install the compatibility RPM's using rpm -i.

DB2 Installation

IBM DB2 V7.2 is available from the IBM website as a tarball. Extracting the tarball using tar xf creates a directory called 018_EEE_LNX_NLV. Change directories into that directory.

On Debian Linux and Slackware Linux, edit the db2_install script and comment out the line:

rpm -qa | grep rpm 1>/dev/null 2>/dev/null

Run the db2_install script.

When prompted to specify a keyword, type DB2.EENT and press return.

When the script completes, run rpm -qa and verify that the following RPM's were installed:

db2cnvc71-7.1.0-40
db2gs71-7.1.0-40
db2cucs71-7.1.0-40
db2engn71-7.1.0-40
db2cdrd71-7.1.0-40
db2dj71-7.1.0-40
db2pext71-7.1.0-40
db2cliv71-7.1.0-40
db2rte71-7.1.0-40
db2wcc71-7.1.0-40
db2hten71-7.1.0-40
db2cnvk71-7.1.0-40
db2cj71-7.1.0-40
db2conn71-7.1.0-40
db2smpl71-7.1.0-40
db2xlic71-7.1.0-40
db2cnvj71-7.1.0-40
db2crte71-7.1.0-40
db2cdb71-7.1.0-40
db2das71-7.1.0-40
db2cnvt71-7.1.0-40
db2repl71-7.1.0-40
db2adts71-7.1.0-40
db2jdbc71-7.1.0-40
db2adt71-7.1.0-40
Ignore the Misinformation

There are many, many instances where the DB2 Version 7.2 distribution identifies itself as version 7.1 instead of 7.2. For example, the RPM's have a 7.1.0 version number. These clues might lead one to think that he or she has accidentally installed version 7.1 instead of version 7.2, but this is not the case.

Install the Documentation

For version 7.2, once the RPM's are installed, you can install the documentation by running /usr/IBMdb2/V7.1/doc/db2insthtml en_US. To view the documentation, point your browser at /usr/IBMdb2/V7.1/doc/en_US/html.

Creating an Instance

IBM DB2 is installed under either /opt/IBMdb2/V7.1, /usr/IBMdb2/V7.1 That directory will be referred to as BASE_DIR in this document.

A DB2 installation consists of an administration server and one or more instances. Each instance contains one or more databases. The administration server coordinates the instances. The administration server is owned by an OS-level user. Each instance is owned by a seperate OS-level user as well.

To create an instance and an administration server, run BASE_DIR/install/db2setup, a text-based installation program.

Select [ Create... ]
Select Create a DB2 Instance
Accept the default user name (db2inst1).
Accept the default UID.
Accept the default group name (db2iadm1).
Accept the default GID.
Pick a password.
Select [ OK ]

A screen for creating the Fenced User (the user that will run user defined functions and stored procedures) will now appear.

Accept the default user name (db2fenc1).
Accept the default UID.
Accept the default group name (db2fadm1).
Accept the default GID.
Pick a password.
Select [ OK ] This will return you to Create DB2 Services screen.

Select Create the Administration Server
Accept the default user name (db2as).
Accept the default UID.
Accept the default group name (db2asgrp).
Accept the default GID.
Pick a password.
Select [ OK ]
If you get a DB2SYSTEM will be set to ... dialog, select [ OK ].

On the Create DB2 Services screen, select [ OK ]
Select [ Continue ]
Select [ OK ] in the This is your last chance to stop dialog.

Now the instance and administration server will be created.
If all went well, you'll get a Completed Sucessfully. notice.
To exit,
Select [ OK ]
Select [ OK ]
Select [ Close ]
Select [ OK ]

Should you need to create additional DB2 instances, follow this procedure again using a different user name and skipping the steps pertaining to the Administration Server. The BASE_DIR/instance/db2ilist command lists all of the DB2 instances on the local computer.

If you need to drop an instance, run BASE_DIR/instance/db2idrop instancename, substituting the name of the instance you want to drop for instancename.

The BASE_DIR/instance/dasilist command lists all of the DB2 administration servers on the local computer.

If you need to drop an administration server, run BASE_DIR/instance/dasidrop servername, substituting the name of the administration server you want to drop for servername.

Enable Remote Access

By default, a DB2 instance only accept connections from clients running on the local machine. To enable connections from clients running on a remote machine over TCP, execute commands like the following. These commands set up the db2inst1 instance on port 50000.

log in as root
view /etc/services and look for a line like:
db2cdb2inst1 50000/tcp # Connection port for DB2 instance db2inst1
if no such line exists, add it
log in as db2as
run the following commands:
. /home/db2inst1/sqllib/db2profile
db2 "update database manager configuration using svcename db2inst1"
db2stop
db2start

Now the db2inst1 instance should be accessible to remote clients on port 50000.

Starting the Database at Boot Time

During the DB2 installation process, /etc/inittab is modified such that the database will be started at boot time. However, if you would like to start and stop the database at will, you can use the following script.

#!/bin/sh

case "$1" in
        start)
                /usr/IBMdb2/V7.1/instance/db2istrt
        ;;
        stop)
                /usr/IBMdb2/V7.1/instance/db2ishut
        ;;
        *)
        echo $"Usage: $0 {start|stop}"
        exit 1
esac

exit 0


Install this script and run it with the "start" option to start up the database. Running it with the "stop" option shuts the database down. To access a database, it must be running.