Jan Schreiber - Blog - Software - About

jan.bio

Installation of IBM DB2 V7.1 on Debian Linux 3.0 (woody)

Abstract: This document describes step-by-step the installation of IBM DB2 V7.1 on woody. If you plan to install DB2 on other Linux distributions or want to learn more about installation issues, please refer to Dan Scott's DB2 Version 7.1 for Linux HOWTO.

I started the installation with a rpm archive which came together with SuSE 7.2. The file is about 80MB, so I didn't want to download the latest version with my ISDN connection. The whole installation process has to be done as root. I had to install the alien-package to convert the archives:

hedvig:~# apt-get install alien

The file on the SuSE CD is called full-names/i386/db2pe-7.1.0-4.i386.rpm and is placed on CD 5 of the CD set (or on the DVD). First I created a temporary directory for the installation.

hedvig:~# mkdir /tmp/db2
hedvig:~# cd /tmp/db2

Then I converted the rpm to a .tgz archive:

hedvig:/tmp/db2# alien --to-tgz /cdrom/full-names/i386/db2pe-7.1.0-4.i386.rpm
db2pe-7.1.0.tgz generated

This archive contains several rpm-archives, which will be installed later. I then extracted the archive:

hedvig:/tmp/db2# tar xzf db2pe-7.1.0.tgz

Next, I wrote a short script as mentioned in the DB2 HOWTO and made it executable:

#!/bin/bash
cd /
for f in /tmp/db2/var/lib/db2pe/*rpm
do
alien -d -i -c $f
done

I ran the script. All rpms are converted to .deb-files and installed.

When I started the DB2 binaries, I got the following error message:

/usr/IBMdb2/V7.1/adm/db2licm: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory

To correct this, I created the missing link manually and started ldconfig to rescan the library paths:

hedvig:/tmp/db2# ln -s /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so /usr/lib/libstdc++-libc6.1-1.so.2
hedvig:/tmp/db2# ldconfig

I also added the DB2 library path /usr/IBMdb2/V7.1/lib to my /etc/ld.so.conf file and ran ldconfig.

The license file had to be installed manually, since this is not done by alien. Otherwise DB2 would start in a time-limited 90-days trial mode:

hedvig:/tmp/db2# /usr/IBMdb2/V7.1/adm/db2licm -a /tmp/db2/usr/lib/db2pe/db2/license/db2udbpe.lic

As a next step, I had to create the DB2 users db2as, db2inst1, db2fenc1 manually. My tip is: Make sure to choose safe passwords, since the earlier mentioned users have full access to the database.

hedvig:/tmp/db2# addgroup db2as
Adding group db2as (104)...
Done.
hedvig:/tmp/db2# adduser --ingroup db2as db2as
Adding user db2as...
Adding new user db2as (1001) with group db2as.
Creating home directory /home/db2as.
Copying files from /etc/skel
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for db2as
Enter the new value, or press return for the default
Full Name []: DB2 Administration User
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/n] y
hedvig:/tmp/db2#

Installation of the DB2 Administration Server:

hedvig:/tmp/db2# /usr/IBMdb2/V7.1/instance/dasicrt db2as
DBI1070I Program dasicrt completed successfully.

Now I created the users for the DB2 instance:

hedvig:/tmp/db2# addgroup db2inst1
Adding group db2inst1 (105)...
Done.
hedvig:/tmp/db2# adduser --ingroup db2inst1 db2inst1
Adding user db2inst1...
Adding new user db2inst1 (1002) with group db2inst1.
Creating home directory /home/db2inst1.
Copying files from /etc/skel
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for db2inst1
Enter the new value, or press return for the default
Full Name []: DB2 Instance User
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/n] y
hedvig:/tmp/db2# addgroup db2fenc1
Adding group db2fenc1 (106)...
Done.
hedvig:/tmp/db2# adduser --ingroup db2fenc1 db2fenc1
Adding user db2fenc1...
Adding new user db2fenc1 (1003) with group db2fenc1.
Creating home directory /home/db2fenc1.
Copying files from /etc/skel
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for db2fenc1
Enter the new value, or press return for the default
Full Name []: DB2 Fenced User
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [y/n] y
hedvig:/tmp/db2#

The installation of the DB2 instance is done via db2icrt

hedvig:/tmp/db2# /usr/IBMdb2/V7.1/instance/db2icrt -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.

DB2 was now properly running. To start the server, I logged in as db2inst1 and cd'd to ~/sqllib. The correct PATH and some environment variables had to be set. I did this via a script called db2profile (the two dots are important!):

db2inst1@hedvig:~/sqllib$ . ./db2profile

DB2 could now be started with db2start. Tip: Use the Command Line Processor db2 -t to test the database.

If you want to access DB2 from PHP, read the next section.

I hope that you find this little HOWTO useful. Please send your suggestions to my email address below. Note that this document is provided AS IS and WITHOUT ANY WARRANTY. It is published under the GNU free documentation license.

References:

Dan Scott's DB2 Version 7.1 for Linux HOWTO