Installing IBM DB2 Enterprise 7.2 on Linux

Install pdksh

DB2 7.2 requires pdksh (Public Domain Korn Shell). If it did not come with your distribution, you'll need to download and install it.

For RPM based distributions, look for pdksh at rpmfind and install it using rpm -i.

For Debian Linux, run apt-get install pdksh.


DB2 7.2 requires Some Linux distributions come with, others come with (or newer). Some distributions come with both. If your distribution does NOT have, create a symbolic link to the newer library as follows.

(These instructions assume that your system has ncurses version 5.2 and that 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

Install Compatibility Packages

DB2 V7.2 for Linux requires glibc 2.1. On distributions that come with newer versions of glibc it is necessary to install some compatibility packages.

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.

  • compat-glibc-6.2- for RedHat Linux 7.3
  • compat-egcs-6.2- for RedHat Linux 7.3
  • compat-libstdc++-6.2- for RedHat Linux 7.3

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

DB2 Installation

IBM DB2 V7.2 was once 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 edit the db2_install script and comment out the line:

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

If you're installing on a computer that gets moved around a lot (such as a laptop) and gets assigned more than 1 hostname, you should set the hostname to localhost now using the following command:

hostname localhost

The installer will name the database after whatever hostname your computer currently has. This will cause the database to be inaccessible when that hostname doesn't resolve or resolves to a computer other than yours.

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:


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.

Restore unixODBC if Necessary

The DB2 installation creates symbolic links from include files in its base directory to /usr/include. If you had a unixODBC-devel RPM installed prior to installing DB2, the include files provided by the unixODBC-devel RPM will have been overwritten by these symbolic links. You should probably reinstall the unixODBC-devel RPM. SQL Relay looks in the DB2 installation directory for DB2 includes, so not having them in /usr/include won't hurt, but not having the proper unixODBC includes in /usr/include will cause the ODBC database connection build to fail.

This should be enough you get you started. To set up more complex configurations, consult the documentation that came with your DB2 distribution.

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 db2cdb2inst1"

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

Creating a Sample Database

To create a sample database, run the command /usr/IDMdb2/V7.1/bin/db2sampl.

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.


case "$1" in
        echo $"Usage: $0 {start|stop}"
        exit 1

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.

You can control which instances start at boot time using the following commands. To get each instance to start at boot time, you need to run the following command as root for each instance:

/usr/IBMdb2/V7.1/bin/db2iauto -on INSTANCE_USER

Where INSTANCE_USER is replaced by the username of the user associated with the instance you want to start at boot time.

If you want to disable an instance from starting at boot time, you need to run the following command as root for each instance:

/usr/IBMdb2/V7.1/bin/db2iauto -off INSTANCE_USER

No comments:

Post a Comment