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).
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}' |
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
Initialize the RPM database.
bash# rpm --initdb |
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 |
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 |
Make the RPM wrapper executable:
bash# chmod +x /bin/rpm |
Install DB2 using the db2setup command by following the instructions in Section 4.
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
Log on to your Linux server with the DB2 instance user ID. Remember, the default user ID is db2inst1.
Prepare your DB2 environment by running the db2profile script:
bash$ cd ~/sqllib bash$ . ./db2profile |
Run a query against the sample database to test your installation.
bash$ db2 bash$ db2 => connect to sample bash$ db2 => select * from employee |
bash$ db2 => quit |
After you install DB2
Remove the RPM wrapper script by removing, renaming, or linking it directly to /usr/bin/rpm.
bash# rm /bin/rpm |
Change /bin/sh back into a symlink to /usr/bin/bash.
bash# ln -sf /usr/bin/bash /bin/sh |
Thorough information on installing DB2 on Slackware 7.1 using RPM is available from James Phillips' page, Installing DB2 on Slackware Linux.