return to first page linux journal archive
keywordscontents

IBM's Universal Database

Getting DB2 up and running on Linux.

by Paul Zikopoulos

Have you been trying to install DB2 Universal Database on a Linux-based workstation? Did you run into some troubles? As I scan around the DB2 and Linux newsgroups, I hear from many of users who are getting frustrated when trying to get DB2 running on Linux. How did this problem get so big? Well, the Linux phenomenon is relatively new and ever-changing. Recently, all sorts of vendors are flocking to market their distributions, with slight differences between them all. Combine that with what seems to be quarterly releases and you can see how communication channels between the Linux vendors and the people who build applications to run on them get clogged. While efforts are being made between application developers and Linux vendors to define this communication pipe, you can use the information in this article to get yourself up and running in no time at all.

DB2 for Linux is officially supported on the following Linux distributions: Caldera OpenLinux, Red Hat Linux, TurboLinux and SuSE Linux. This article will take you through the steps involved in installing DB2 on each of the supported Linux distributions. In the article, I assume you have not previously installed a version of DB2 and you are not maintaining any of the default users created by a default DB2 Installation. The three user IDs that will be created during a DB2 installation are: db2inst1, db2fenc1 and db2as. If you have any of these users on your system, be sure to remove them and their associated directories before installing DB2. This article also assumes you are familiar with the rpm command, used to install packages. If you are not familiar with this command, refer to your Linux documentation.

In order to run DB2 on Linux, the following are required:

Preparing Your Linux Workstation for a DB2 Installation

The following sections will highlight any actions you need to perform on your Linux workstation to enable it for a DB2 installation. If a requirement exists by default on your system, I will not make note of it in the sections that follow. Keep in mind that the lag time between when this article was written and when you are going to read it may be a couple of months. In that time, some of the levels or links I have referred to here may have changed.

DB2 and Caldera OpenLinux

The information I am providing in this section is based on a Caldera OpenLinux version 2.3, or simply Caldera, Standard Installation type. If you installed a different installation type on your Linux workstation, you may have to add some of the required packages to your workstation.

The pdksh package is missing from the default Standard Installation. This package is available on the Caldera CD-ROM; however, it is not compatible with DB2. IBM and Caldera are working to solve this problem, but in the meantime, I recommend you download a pdksh package from a Red Hat mirror site--it will work just fine. I am sure Caldera Systems will post a fix sometime on their FTP site at ftp://ftp.calderasystems.com/pub/.

For now, go to the mirror site at http://www.metalab.unc.edu/pub/Linux/distributions/redhat/redhat-6.1/i386/RedHat/RPMS/. Download the pdksh-5.2.14-1.i386.rpm package and install it with the rpm command using the -nodeps option. If you try to install this package without the -nodeps option, you will receive an error stating that this package has a requirement on the glibc package. This error is only a result of the different naming conventions used by Caldera Systems and Red Hat. A glibc package is installed by default.

For DB2 version 6, you require libstdc++ 2.80, DB2 v6 will not run with libstdc++ 2.9.0. Caldera version 2.3 by default installs with libstdc++ 2.9.0. The required libstdc++ 2.8.0 is located on the CD-ROM in the /col/contrib/RPMS directory as a package called libstdc++-compat-2.8.0-1.i386.rpm.

If you are running Caldera version 2.2, I recommend that you upgrade to version 2.3; it will make your DB2 installation much easier. In the event you do not want to do this, there are some things you will need to note on top of the issues I mentioned for Caldera version 2.3.

First, the libstdc++-compat-2.8.0-1.i386.rpm package, is not on the CD-ROM. You can get it from Caldera at ftp://ftp.calderasystems.com/pub/openlinux/2.3/contrib/RPMS/.

Finally, DB2 requires a file called libcrypt.so.1 to work. This file is usually shipped with every Linux distribution. Some problems with federal export laws caused Caldera version 2.2 to ship without this file. To add this file to your workstation, download the package glibc-crypt-2.1-3i.i386.rpm from ftp://ftp.linuxland.de/pub/OpenLinux/crypto/2.2/RPMS/. I could not find this fix on Caldera's FTP site.

Once you have completed these tasks, your Caldera version 2.2 workstation is ready for a DB2 installation.

DB2 and TurboLinux

The information I provide in this section is based on a TurboLinux version 3.6 Base Workstation installation. If you installed a different installation type on your Linux workstation, you may have to add some of the required packages to your workstation.

There are some problems trying to get DB2 to run on a workstation running TurboLinux. Download a fix from the Web at: ftp://ftp.software.ibm.com/ps/products/db2/tools/. The fix is called tl36_instfix.tar.Z, note that the l is the letter ``l'' not the number ``1'' All the information you require to implement this fix is mentioned in the README file called tl36_instfix.readme.txt.

After you have downloaded the fix, you need to add the pdksh package, which is not part of the Base Workstation installation. This file is available on the TurboLinux CD-ROM, in the /TurboLinux/RPMS directory.

Once you have completed these tasks, your TurboLinux version 3.62 workstation is ready for a DB2 installation.

DB2 for SuSE Linux

The information that I am providing in this section is based on a SuSE version 6.3 Network Oriented System installation. These instructions also apply to a workstation running SuSE version 6.2. If you installed a different installation type on your Linux workstation, you may have to add some of the required packages to your workstation.

The biggest problem with installing DB2 on a workstation that is running SuSE Linux is the naming convention that SuSE uses for its packages. For example, SuSE calls the required glibc package shlibs. This will causes problems when you try to install DB2 because the DB2 installation utility will fail to recognize the existence of the required glibc package. To get around this problem, you have to install a dummy package, called glibc-2.0.7-0.i386.rpm. This package is located in the /db2/install/dummyrpm directory on your DB2 product CD-ROM.

Additional Steps for SuSE Version 6.1

SuSE Linux version 6.1 ships with a beta copy of the DB2 for Linux version 5.2 code. Consequently, when you go to install DB2, this causes problems with the default users. To make things ever stranger, I noticed that when I installed the Network Oriented System installation, which was not supposed to include DB2, the default DB2 users were created. To make matters worse, I could not find any information about the passwords for the DB2 users that SuSE creates (they are not the default DB2 passwords), and some of the settings that SuSE implements do not work for DB2. In the end, remove the users (db2inst1, db2as, db2fenc1) that the SuSE installation creates. For more information on SuSE user management, refer to your product's documentation.

Once you have completed these tasks, your SuSE version 6.1 workstation is ready for a DB2 installation.

DB2 and Red Hat Linux

The information I provide in this section is based on a Red Hat version 6.0 Server installation. These instructions also apply to a workstation that is running Red Hat version 5.2, though the names of the packages may be at a different level. If you installed a different installation type on your Linux workstation, you may have to add some of the required packages to your workstation.

Both the Red Hat version 5.2 and version 6.0 installation are easy to enable for a DB2 installation. They are both missing the required pdksh package that is required to run the DB2 Installer. This package is located in the /RedHat/RPMS directory on the Red Hat CD-ROM.

If you are trying to install DB2 on a workstation that is running Red Hat version 6.1, you aren't going to get very far due to a problem with this version of Red Hat v6.1 and DB2. You can download the Red Hat fix at ftp://ftp.software.ibm.com/ps/products/db2/tools. The fix you need depends on where you got your DB2 code. If you are installing the copy of DB2 bundled with Red Hat 6.1, download the file db2rh61fix.tgz. If you are installing any other DB2 code, you need to download the db2rh61gafix.tgz file.

After you download the appropriate fix, unpack them by entering the tar xvzf filename command, where filename is the name of the downloaded fix file. After unpacking this file, you will see three files in the directory. Once of them is a README file, called readme.txt. This file gives complete and detailed instructions on how to implement this fix.

Once you have completed these tasks, your Red Hat version 6.1 workstation is ready for a DB2 installation.

Installing DB2

Installing DB2 is made easy by an installation and setup utility called DB2 Installer. This utility will install all required packages for DB2, create instances for DB2 databases and administration support, and configure your DB2 server for communications. The instructions in this section assume you do not change any of the defaults presented by DB2 Installer, unless noted in the steps below.

You will usually run into display problems if you start DB2 Installer from a command window in your Linux distribution's graphical interface. You can refresh the view of DB2 Installer at any time by pressing CTRL-L. To avoid most potential display problems, I recommend running the DB2 Installer in a virtual console session outside of your operating system's graphical interface. You can shift between the virtual console session and the graphical interface session on most Linux distributions by pressing CTRL-ALT-F1 and CTRL-ALT-F7. Refer to your Linux documentation for more details.

To quickly install DB2, perform the following steps:

	mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom

You are finished all the steps necessary to install DB2!

Verifying your DB2 Installation

Now that you have finished your installation, let's go through a quick sample query to prove to you that this powerful database is actually alive and running on your system.

To verify your installation, perform the following steps:

	db2 connect to sample
	Database Connection Information
	Database server = DB2/LINUX 6.1.0
	SQL authorization ID = DB2INST1
	Local database alias = SAMPLE
	db2 "select * from staff where dept = 20"
Table 1

Enabling the DB2 Graphical Tools

You must have the prerequisite Java Runtime Environment (JRE) level to use the DB2 Administration Tools. For more information, refer to the Control Center README, which can be found in the INSTHOME/sqllib/cc/prime directory, where INSTHOME is the home directory of the user created for the instance during the installation (for example, /home/db2inst1/sqllib/cc/prime). Let me save you some time and take you through the quickest way I found to get the graphical tools running on your workstation. Perform the following steps:

Now, you have completed all the steps necessary to configure your workstation for the DB2 graphical tools.

If you followed the steps and considerations that I have outlined in this article, you should have a running copy of DB2 on your Linux workstation, a sample database, a running Control Center and a smile on your face!

Paul Zikopoulos (paulz_ibm@yahoo.com) is a senior member of the DB2 information and development team, specializing in DB2 installation and configuration issues. He has more than five years experience with the DB2 Universal Database, and has written magazine articles and books about DB2. Paul is an IBM Certified Advanced Technical Expert (DRDA and Cluster/EEE) and an IBM Certified Solutions Expert with DB2 Universal Database.