5. Installing DB2 on other Linux distributions

DB2 Version 7.1 is distributed as a set of RPM packages. If you want to install DB2 on a distribution that is not officially supported by IBM, and that distribution satisfies all of the prerequisites specified in Section 2, all that you theoretically need to do is find a way to install those packages on your distribution. The alien utility available from Kite converts RPM packages into formats supported by Debian (dpkg), Stampede (slp), and Slackware (slp).

Debian

Susan Williams reported success in installing DB2 Version 7.1 on Debian using the following script as root:

Example 1. Installation script for DB2 Version 7.1 on Debian


#!/bin/bash
cd /
for f in /mnt/cdrom1/db2/*rpm
do
alien -d -i -c $f
done

This script installs every DB2 package on the CD-ROM. In a future iteration of this document I plan to provide a description of all of the DB2 packages to help you develop a more selective approach for your installation.

Christoph Shmitz reports that, while he was able to install DB2 Version 7.1 Personal Developer's Edition on Debian 2.2 using alien as described above, DB2 starts in a time-limited trial mode (90 days). While the use of DB2 Version 7.1 Personal Developer's Edition should be unlimited, alien does not automatically install the DB2 license file.

To remove the time limit on DB2 Version 7.1 Personal Developer's Edition, you need to manually install the license file (s000510.personal/db2/license/db2udbpe.lic in the tar archive) using the following command as root:


bash# db2licm -a db2udbpe.lic

Using alien apparently prevents you from using the db2setup command to create instances. To create a DB2 Administration Server from the command line, issue the /usr/ibmdb2/v7.1/instance/dasicrt command as root. To create a DB2 instance, issue the /usr/ibmdb2/v7.1/instance/db2icrt command as root. To get the correct syntax for either command, use the -h flag.

For further information on installing DB2 on Linux distributions which use the dpkg package manager, see Tiago Antao's page, Agnostic DB2 V7.1 for GNU/Linux.

In the following section, Andika Triwidada describes how to install DB2 on Debian 2.2 using the rpm command. You can check the prerequisite package levels (described in Section 2) installed on your system with the following command:


bash$ dpkg -l|egrep -e '(libc6|libstdc++|pdksh|rpm|zip)'|awk '{print $1,$2,$3}'
The resulting list should contain:

  ii  libc6                 2.1.3-13
  ii  libstdc++2.9-glibc2.1 2.91.66-4
  ii  pdksh                 5.2.14-1
  ii  rpm                   3.0.3-1
  ii  unzip                 5.40-1

If you are missing any of these packages, you can install the package using apt-get:


bash# apt-get install package-name

Installation Steps

  1. Initialize the RPM database.

    
bash# rpm --initdb
    

  2. Modifiy several files in /bin

    
bash# mv /bin/sh /bin/sh.bash
    bash# ln -s /usr/bin/ksh /bin/sh
    bash# for f in awk basename ksh passwd sort touch; do ln -s /usr/bin/$f /bin/$f; done
    

  3. Copy the contents of the following script to create an RPM wrapper called /bin/rpm.

    
#!/bin/sh
    # RPM wrapper, force RPM installation without checking any dependencies
    if [ "$1" = "-ivh" ]
    then
      shift
     /usr/bin/rpm -ivh --nodeps $*
    else
     /usr/bin/rpm $*
    fi
    

  4. Make the RPM wrapper executable:

    
bash# chmod +x /bin/rpm
    

  5. Install DB2 using the db2setup command by following the instructions in Section 4.

  6. Create the DB2 administration server and at least one DB2 instance as described in Section 6. To simplify testing, ensure that you create the sample database when you create the DB2 instance.

Testing your DB2 installation

  1. Log on to your Linux server with the DB2 instance user ID. Remember, the default user ID is db2inst1.

  2. Prepare your DB2 environment by running the db2profile script:

    
bash$ cd ~/sqllib
    bash$ . ./db2profile
    

  3. Run a query against the sample database to test your installation.

    
bash$ db2
    bash$ db2 => connect to sample
    bash$ db2 => select * from employee
    
    There should be a printout of records from sample database here
    
bash$ db2 => quit
    

After you install DB2

  1. Remove the RPM wrapper script by removing, renaming, or linking it directly to /usr/bin/rpm.

    
bash# rm /bin/rpm
    

  2. Change /bin/sh back into a symlink to /usr/bin/bash.

    
bash# ln -sf /usr/bin/bash /bin/sh
    

After installing DB2 with alien, Claus Reiner reported that:

While all components of DB/2 were installed, the instance apparently didn't know them and thus couldn't use them. After a lot of sweat going through the configurations, IBM support told me that I should make an instance update which solved it. (The instance could locally and between Unixen do everything, only when trying to connect to AS/400 using DCS it told us 'authentication not supported').

Claus recommends running the following commands as root after installing DB2 with either alien or RPM,

bash# . $INSTANCEHOME/sqllib/db2profile
bash# /usr/IBMdb2/V7.1/instance/db2iupdt -e

Slackware

Thorough information on installing DB2 on Slackware 7.1 using RPM is available from James Phillips' page, Installing DB2 on Slackware Linux.