IBM DB2 for Linux HOWTO

Posted on 3:25 PM by Bharathvn

This HOWTO is intended for anyone interested in installing and using the IBM
DB2® Express-C 9 database on a Linux® operating system. The aim of this
document is to provide additional support and specific distribution details
to get you up and running with DB2 on your Linux distribution of choice.

. Introduction

1.1. Who should read this HOWTO

This HOWTO is intended for anyone interested in installing and using IBM DB2®
Express-C 9 on a Linux® distribution. The goal is to include as many
distributions as possible, on both 32??bit and 64??bit architectures, however
both hardware and time resources are constrained, so if you come across a
distribution/architecture combination that isn't covered in here or if you
encounter a problem that isn't addressed, send a note to db2howto@gmail.com
and I'll try to help verify or resolve your issue and add the information
here.

The information found in this document is based on personal experiences
installing and configuring IBM DB2 9 Express-C.
2. Why DB2 Express-C 9?

In March of 2006, IBM made a strategic decision to release their best of
breed DB2 database as freely available software. It is important to realize
that the DB2 Express-C edition is a gratis, "free as in beer" software
product, meaning that, although the source code is not distributed as part of
the product, this edition of DB2 is freely useable and full featured, not
"crippled" in any way.

A number of other large enterprise class databases have also opted to release
versions of their software, but DB2 Express-C is the only one that places no
restrictions on the size or number of the databases that can be created. The
one restriction to using DB2 Express-C is that it can only be run on systems
with 2 physical CPUs and 4 GB of RAM. Since the majority of developers and
small businesses run systems within these specifications, DB2 Express-C makes
a great choice for developers and business applications. In this HOWTO, all
testing and discussions are based on machines that fall within these system
specifications.

With DB2 Express-C, you get a free, low maintenance database application that
is easy to install and run, with a number of powerful features, as well as
performance typically found in much more expensive enterprise-level database
software.
-----------------------------------------------------------------------------

3. What's included in DB2 Express-C 9

Feature-wise, what's included in the DB2 Express-C download is impressive.
To start with, you get the same database engine code as the full
enterprise-level database server, with no connection restrictions. Also
included is the full suite of commmand line and graphical user tools to help
adminster databases and develop database applications. You also get autonomic
maintenance features, along with development APIs and drivers for C/C++,
Java, PHP, Perl and Ruby on Rails.

The cherry on top is the inclusion of IBM's new pureXML?? hybrid technology
that allows you to store XML data natively inside the database, without any
shredding or decomposition of the data. This is a feature that is typically
an add-on to the other editions of DB2 9, and IBM is giving it to users of
the Express-C edition completely free of charge. Sometimes it's good to be
the little guy.

There are three architecture choices available for Linux: the 32-bit version,
the 64-bit version, and the PowerPC version, giving you the option of using
the best hardware you have available for your DB2 installation.
-----------------------------------------------------------------------------

4. Prerequisites

Prerequisites are the hardware and software elements needed on your system
before you can install and use DB2 Express-C 9. This section covers:

* Hardware requirements:

+ Supported processors
+ Disk space requirements
+ Memory requirements

* Software requirements:

+ Linux distributions
+ Kernel levels and libraries requirements
+ Additional software requirements


-----------------------------------------------------------------------------
4.1. Hardware requirements

4.1.1. Supported processor architectures

* x86 (32-bit processor)
* x86??64 (64-bit processor)
* POWER?? (any iSeries?? or pSeries® that supports Linux)

-----------------------------------------------------------------------------
4.1.2. Disk space requirements

Take into account the disk space requirements before you install and
configure DB2 on your distribution:


Table 1. Disk space requirements
+------------------------+------------------------+------------------------+
|Install type |Description |Required disk space |
+------------------------+------------------------+------------------------+
|Typical |DB2 is installed with |460 to 560 MB |
| |most features and | |
| |functionality, including| |
| |graphical tools such as | |
| |the Control Center. | |
+------------------------+------------------------+------------------------+
|Compact |DB2 is installed with |380 to 460 MB |
| |basic features and | |
| |functionality, but | |
| |without the graphical | |
| |tools. | |
+------------------------+------------------------+------------------------+
|Custom |This option allows you |320 to 820 MB |
| |to select the features | |
| |and functionality that | |
| |you want to install. | |
+------------------------+------------------------+------------------------+

It's important to allocate enough disk space for the software, along with the
product documentation (if desired) and the databases you create.

In DB2 9, product documentation is accessed through the DB2 Information
Center, either via the web, or as a local system installation. To install
this locally requires at least 100 MB when installing the core English
language files. Additional space is required for other additional languages.
If disk space is an issue, you can configure DB2 to access the Information
Center from the Web. More detail about this is provided in Installing the DB2
Information Center.
-----------------------------------------------------------------------------

4.1.3. Memory requirements

We recommend that you should allocate a minimum of 512 MB of RAM for DB2
Express-C 9, and additional memory should be allocated for other software and
communication processes. When determining memory requirements, consider the
following points:

* Your SWAP space should be at least twice as much as your RAM.
* Additional memory should be allocated for any non-DB2 software that may
be running on your system.
* Additional memory is necessary to support database clients and database
activity.
* These memory requirements will be affected by the size and complexity of
your database system, as well as specific performance requirements.
* The maximum RAM allowed for a DB2 Express-C installation is 4 GB.

-----------------------------------------------------------------------------
4.2. Software requirements

4.2.1. Distribution levels that are supported by DB2 Express-C 9

For a list of all the distributions that are officially supported, as well as
the latest information about kernels, libraries, integrated cluster
environments, and papers, visit the DB2 for Linux validation web site listed
in Resources.
-----------------------------------------------------------------------------

4.2.2. Additional software requirements

Depending on your DB2 requirements, you may be required to install additional
software packages for DB2 to function properly. Make sure that these software
packages are installed prior to using DB2.

* X Window System software, capable of rendering a graphical window manager
(KDE, Gnome, etc.). You will need this if you want to use the DB2
graphical installer, or any of the DB2 graphical tools.

* A web browser, to view topics in the DB2 Information Center.

* If you are using NIS or NIS+ for security authentication on your system,
you must create DB2 user accounts before installing DB2.

* Additional packages, as outlined in the following table:


Table 2. Package requirements
+----------------+------------------+----------------------------------------+
|Package name |RPM name |Description |
+----------------+------------------+----------------------------------------+
|compat-libstdc++|compat-libstdc++ |Required by 64-bit architectures only. |
| | |Required for backwards compatibility |
| | |with standard C++ libraries used by DB2.|
+----------------+------------------+----------------------------------------+
|nfs-utils |nfs-utils (version|Network File System support package. It |
| |1.0 or later) |allows access for local files to remote |
| | |machines. Required for systems utilizing|
| | |NFS mounted drives. |
+----------------+------------------+----------------------------------------+
To check whether you have these packages installed, use the rpm -q
commands:
rpm -qa compat-libstdc++*

To install these packages on Red Hat Linux, use the Red Hat Linux
installation CDs and the rpm command, or the up2date utility. For
example, to install the compat-libstdc++ package from the Red Hat Linux
CD, mount the Red Hat Linux CD #4, and enter this command as root:
rpm -ivh /mnt/cdrom/RedHat/RPMS/compat-libstdc++-296-2.96-132.7.2.i386.rpm
To install using the up2date package, run this command as root:
up2date compat-libstdc++

To install these packages on SUSE Linux, you can also use rpm or use the
handy YaST (Yet another Setup Tool) utility. For example, to install
nfs-utils on SLES 9 using YaST:

1. Log on as root

2. From the YaST Control Center, select Software -> Software Management,
then use the search "nfs-utils" to find the appropriate packages.



-----------------------------------------------------------------------------
5. Installation considerations and planning

After verifying that your system meets the basic requirements, you should
plan your installation by considering installation methods and the creation
of users and groups:

* Installation choices:

+ db2setupinstallation
+ db2_installinstallation
+ DB2 response file installation

* User and group setup:

+ User and group requirements
+ Creating users


-----------------------------------------------------------------------------
5.1. Installation methods

After downloading and extracting the tar.gz file, the file tree looks like
this:
exp/ -|
disk1/ -|
db2_install (* command line installation script *)
db2setup (* GUI installation launcher *)
installFixPack (* not applicable for Express-C *)
db2/ -| (* installation and licensing files *)
doc/ -| (* install instructions and release notes *)

You can use three methods to install DB2:

* db2setup utility

* db2_install utility

* a DB2 response file


Each method has its own advantages and disadvantages. The choice of method
depends on your level of expertise and type of environment, but in general,
if a graphical interface is available, using db2setup is recommended for ease
of installation.
-----------------------------------------------------------------------------

5.1.1. db2setup installation

The db2setup command starts the DB2 Launchpad, a graphical tool that
configures and organizes the DB2 installation. It lays down the DB2 filesets,
creates and configures DB2 instances, users and groups, communications, the
administration database used by the DB2 Tools, and sets up notification
processes. The DB2 Launchpad also allows you to create a response file for
replicating a particular setup to other systems.

Using db2setup is the best method for less experienced users, because most of
the configuration is automatically performed during the installation. As
mentioned previously, you require an X Window System capable of rendering a
graphical user interface to use db2setup successfully.
-----------------------------------------------------------------------------

5.1.2. db2_install installation

The db2_install command script installs all DB2 packages on your Linux
system. This method is reliable and commonly used by expert users for
installing DB2 on larger, more complex systems. However, tasks such as
setting up users and groups, creating instances, tools catalog database
creation, and notification setup need to be performed manually after the
installation is completed.

One limitation to db2_install is that it only installs user assistance (like
help, messages, and tool interfaces) in English, whereas db2setup supports
the installation of additional languages. Also, a db2_install installation
can take longer (because of the higher number of manual configuration tasks);
it requires a higher level of knowledge and skill, and it cannot be used to
create response files.
-----------------------------------------------------------------------------

5.1.3. Response file installation

A response file can be created using the DB2 Setup Wizard or by editing an
existing DB2 response (.rsp) file. It allows you to install DB2 across
multiple machines with consistent installation and configuration settings. A
response file installation is fast, because it bypasses the graphical wizard
configuration. Another advantage of using a response file instead of the
db2_install command is that it creates a Database Administration Server (DAS)
on each machine, while with db2_install the DAS must be created manually
after installation.

There is a sample response file (db2exp.rsp) included on the installation
image that can be modified and used to install DB2, configure users, create
instances, set up notification, create the tools catalog, and configure a
large number of database management parameters. This is the quickest
installation method if you already have all the information you need. Unlike
db2setup, the response file installation is not interactive, and it takes
longer to prepare the response file initially.
-----------------------------------------------------------------------------

5.2. User and group setup

DB2 requires user IDs and groups for database authentication. This section
discusses these IDs and groups and how to create them.
-----------------------------------------------------------------------------

5.2.1. User and group requirements

DB2 requires a minimum of three users and groups: an instance owner, a fenced
user, and the Database Administration Server (DAS) user. You may use the
default names provided by the setup utilities, or specify your own user and
group names. For example, consider the following default user IDs and group
names produced by the DB2 Setup Launchpad:


Table 3. Default user IDs and group names
+------------------+------------------+------------------+------------------+
| Required user | User name | Group name | Description |
+------------------+------------------+------------------+------------------+
|Instance owner |db2inst1 |db2grp1 |Administers a DB2 |
| | | |instance |
+------------------+------------------+------------------+------------------+
|Fenced user |db2fenc1 |db2fgrp1 |Responsible for |
| | | |executing "fenced"|
| | | |user defined |
| | | |functions, such as|
| | | |JDFs and stored |
| | | |procedures. |
+------------------+------------------+------------------+------------------+
|DAS user |dasusr1 |dasadm1 |Administers the |
| | | |DB2 Administration|
| | | |Server |
+------------------+------------------+------------------+------------------+
-----------------------------------------------------------------------------

5.2.2. Creating users

You must have root authority to create users and groups. There are three ways
to create a DB2 user ID:

* DB2 Launchpad: the DB2 Launchpad installation creates all of the required
users and groups for you during installation. The default users and
groups that get created are displayed in the table above. This method
also gives you the option to specify your own user and group names.

* Response file: Users can also be created during a response file
installation if you specify user and group information in the response
file. For example, consider the following entries in a response file that
create the three required users and groups for DB2:
* DAS user
DAS_USERNAME = dasusr1
DAS_GROUP_NAME = dasadm1
DAS_HOME_DIRECTORY = /home/dasusr1
DAS_PASSWORD = ******
* Instance-owning user
inst1.NAME = db2inst1
inst1.GROUP_NAME = db2grp1
inst1.HOME_DIRECTORY = /db2home/db2inst1
inst1.PASSWORD = ******
inst1.AUTOSTART = YES
inst1.AUTHENTICATION = SERVER
inst1.SVCENAME = db2c_db2inst1
inst1.PORT_NUMBER = 50001
inst1.FCM_PORT_NUMBER = 60000
inst1.MAX_LOGICAL_NODES = 4
* Fenced user
nst1.FENCED_USERNAME = db2fenc1
inst1.FENCED_GROUP_NAME = db2fgrp1
inst1.FENCED_HOME_DIRECTORY = /db2home/db2fenc1
inst1.FENCED_PASSWORD = ******

* Manually using command line. To use this method, follow these steps:

1. Log on to your machine as root.

2. Create groups for the instance owner, the fenced user and the DAS
user by using these commands:
groupadd db2grp1
groupadd db2fgrp1
groupadd dasadm1
Linux will create the groups using the first available group ID (GID)
numbers available. You can specify GID numbers if you prefer.

3. Create a user that belongs to each group and specify the home
directory. For example, you can choose to place all home directories
in /db2home by entering these commands:
useradd -g db2grp1 -m -d /db2home/db2inst1 db2inst1 -p password1
useradd -g db2fgrp1 -m -d /db2home/db2fenc1 db2fenc1 -p password2
useradd -g dasadm1 -m -d /db2home/dasusr1 dasusr1 -p password3




-----------------------------------------------------------------------------
5.2.3. Adding existing users as DB2 users

To enable existing system users to act as DB2 instance administrators, you
must make a few modifications to the existing user accounts:

* Add your user to the db2grp1 group. The SYSADM_GROUP database manager
configuration parameter controls who has that level of access for all
databases in that instance. You can determine what group is set as the
SYSADM group by entering:
db2 get dbm cfg | grep SYSADM_GROUP

By default, DB2 sets this as the db2grp1 group. To add the user to the
SYSADM group, modify the /etc/groups file (as root), adding the user
account ID to the line for the DB2 system admin group. For example:
db2grp1:x:102:jackc,ellenp,frankj

* Update the user's profile by adding the following lines to the .bashrc
file in the home directory
# The following three lines have been added by the DB2 SYSADM.
if [ -f /home/frankj/sqllib/db2profile ]; then
. /home/frankj/sqllib/db2profile
fi

* After installation, if you wish to grant or revoke access to databases
(or other objects), use the "User and Groups" section of the Control
Center or the GRANT and REVOKE SQL statements. If you want to see an
example, by default the SAMPLE database grants a number of privileges to
"PUBLIC".


-----------------------------------------------------------------------------
6. Installing DB2 Express-C

This chapter covers a typical setup scenario for installing DB2 Express-C on
a 32-bit Linux system, using the db2setup installation method.
-----------------------------------------------------------------------------

6.1. db2setup installation

6.1.1. Prerequisites



* Ensure that your system meets the software, memory, and disk requirements
outlined in Section 5.

* You require root authority to perform the installation.

* The DB2 Setup Launchpad is a graphical installer. You must have X Window
System software capable of rendering a graphical user interface for the
DB2 Setup Launchpad to run on your machine.


-----------------------------------------------------------------------------
6.1.2. Procedure

To install DB2 Express-C 9:

1. Log on to the system as a user with root authority.

2. If you are installing from a CD or DVD, enter the command to mount the
DB2 installation media. For example,
mount /media/cdrom
If you are using a downloaded tar.gz file, extract the contents of this
archive to a location on your harddrive. For example, presuming the
tar.gz file was downloaded to the /tmp directory:
cd /tmp
tar zxf db2exc_912_LNX_x86.tar.gz

3. Change to the install directory. For the CD/DVD install:
cd /media/cdrom/exp/disk1
For the downloaded and extracted tar.gz file:
cd /tmp/exp/disk1

4. Run the db2setup command.
./db2setup

5. When the IBM DB2 Setup Launchpad opens, select "Install a Product".

6. Select the "Install New" button in the main window.

7. When the Welcome to the DB2 Setup wizard window appears, click "Next".

8. Read the license agreement and select the "Accept" button if you accept
the terms (the "Decline" button is selected by default). Click "Next".

9. On the Select the installation typewindow, select the type of
installation you want to perform. You have three installation options:

+ Typical: 460??560 MB. This option installs and configures most of the
DB2 components, using a typical configuration with default values.
This option includes all of the core features, along with ODBC
support, and commonly used tools such as the Control Center. You can
select the "View Features" button to see what components get
installed with this option.
+ Compact: 380??460 MB. This option installs and configures only the
basic DB2 components, with minimal configuration performed on your
computer. With this option you get the base server and client
support, along with Java and SQL procedure support. Again, you can
click the "View Features" button for more information.
+ Custom: 320??820 MB. This option allows you to install only those
components that you select; and to create and customize a basic DB2
instance.

Make your choice and click "Next". (The remainder of these instructions
are based on the Custom installation option).

10. On the Select the installation action window, choose the "Install DB2
Express on this computer" radio button. You can also choose to save your
installations settings in a response file by selecting "Save your
settings in a response file". You should choose this option if you plan
to install DB2, with these same settings, on other computers in your
environment.

11. Choose the DB2 elements you want on the Select the features to install
window. You can preview each component by selecting it and reading the
corresponding description in the Description section.

You can also choose where to install the DB2 program files. By default
for a first time installation, this location is /opt/ibm/db2/V9.1/ Once
you have decided what features you want to install and the destination,
click "Next".

12. Select what languages you want installed for the messages and user
interface on your computer in the Languages window. English is always
installed, regardless of other language choices. Click "Next".

13. In the Specify the location of the DB2 Information Center window, select
how you want to access the DB2 Information Center. The DB2 Information
Center contains documentation for DB2 and other related DB2 products. The
"On the IBM Web site" button is selected by default. By choosing this
option, DB2 is configured to access documentation on the Web using your
browser. If you have a copy of the DB2 Information Center installed
elsewhere on an intranet server, you can choose the "On the following
intranet server" button. Specify the values in the Host name and Port
number text fields (the default value for the port number is 51000).
Click the "Help" button for more information, otherwise click "Next".

14. Fill out the information for the user that will administer the DB2
Administration Server in the Set user information for the DB2
Administration Server window. Select either the "New user" button, or the
"Existing user" button. The Password and Confirm password text boxes are
outlined in red indicating required fields that must be filled in for the
installation to continue. If you choose to create a new user, a user
account will be created (including a home directory) on your Linux
system. Click "Next".

15. If you want to create a new basic DB2 instance to store your database,
then select the "Create a DB2 instance" button on the Set up a DB2
instance window. Otherwise, select the "Defer this task until after
installation is complete" button. If you select this second option, you
will need to create a new instance after the installation by using the
db2icrt command. Click "Help" for more information, otherwise click "Next
".

16. If you create a new instance, fill out the information for the DB2
instance owner on the Set user information for the DB2 instance owner
window. Select either the "New user" button, or the "Existing user"
button. The Password and Confirm password text boxes are outlined in red
indicating required fields that must be filled in for the installation to
continue. Again, if you choose to create a new user, a user account will
be created (including a home directory) on your Linux system. Click "Next
".

17. Fill out the information for the DB2 fenced user on the Set user
information for the fenced user window. Select either the "New user"
button, or the "Existing user" button. The Password and Confirm password
text boxes are outlined in red indicating required fields that must be
filled in for the installation to continue. For more information on
fenced users, and how fenced users relate to fenced and non-fenced
user-defined functions (UDFs) and stored procedures, click "Help".
Otherwise, click "Next" to continue.

18. Configure the DB2 instance for TCP/IP communications on the Configure
instance IP communication and startup window. You may either accept the
default values found in the Service name and Port number fields, or
select your own. If you want to configure the instance properties at a
later time, select the "Do not configure at this time" button. This
service name and port are added to the services file for the system,
typically found in /etc/services.

You can also choose whether to start up this instance at system startup.
This is recommended if you are planning on running your system as a DB2
server. Click "Next".

19. On the Prepare the DB2 tools catalog window, select the "Prepare the DB2
tools catalog" button if you want to use the Task Center or Task
Scheduler. This option creates a local database that stores task
metadata. If you do not have this task repository, the scheduler will not
function. If you want to create a DB2 tools catalog after you finish the
installation, select the "Do not prepare the DB2 tools catalog" button.
You can create the DB2 tools catalog later manually by using the CREATE
TOOLS CATALOG command. Click "Next".

If you decide to create a DB2 tools catalog, you can specify which
instance, database, and schema in which to store the DB2 tools catalog.
The DB2 tools catalog will be placed in the home directory of the
instance owner. Click "Next".

20. Specify a notification mail server and contact list on the Set up
notifications window. This allows DB2 to notify administrators if a
database requires attention. Either create a new contact list that is
stored locally, or use an existing global contact list that resides on a
remote DB2 server. Use an available SMTP server that will accept an
unauthenticated SMTP message for e-mail notifications. You may also
choose to skip this step; DB2 will still record all administration
notifications in the log files. Click "Next".

21. If you specified a new local list for contacts in the previous step, then
in the Specify a contact for health monitor notification, you can add a
name and email address where DB2 Health Center messages will be sent for
any health alerts from DB2 databases.
22. On the Start copying files window, review the installation settings, and
then click "Finish" to complete the installation. The Current settings
panel provides a summary of your installation and configuration settings.


While the files are being copied to your computer, you will see two status
bars on the Installing DB2 Express window, one indicating the progress of
each individual installation task, and one for the overall installation
progress. When the installation is finished, the Setup Complete window
indicates what, if any, post-installation steps need to be taken, along with
a tab (labelled "Log File") that shows the log file report for the
installation. Click "Finish" to close this window and the Setup Launchpad.
-----------------------------------------------------------------------------

7. Installing DB2 Express-C on Red Hat Enterprise Linux (RHEL) 4

Before proceeding, please ensure that you have read Section 5 and Section 6.

These installation notes are based on a single-partition installation using
the 2.6.9-55.0.2 EL kernel.
-----------------------------------------------------------------------------

7.1. Installation notes

The installation on Red Hat Enterprise Linux 4 completed successfully, with
no problems getting the GUI installer working, and no errors during the
install. This smooth installation isn't surprising, given that RHEL 4 is an
officially supported platform for DB2.
-----------------------------------------------------------------------------

7.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the iptables-based firewall (which is
enabled by default), it was necessary to modify the iptables firewall
ruleset, which is kept in the /etc/sysconfig/iptables file. If you have
enabled your firewall (using the iptables service), and you want to enable
external connectivity to your DB2 server, you must open up TCP and UDP access
to ports 523 and TCP access to any DB2 service ports. To make this work, add
these rules to the iptablesfile (anywhere amongst the -j ACCEPT rules):
-A RH-Firewall-1-INPUT -p udp -m udp --dport 523 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 523 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 50000 -j ACCEPT
These rules were added directly to the iptables file to ensure that they
persist in case of a system reboot. Note that you will need to add another
new TCP rule to allow firewall access if you create any additional instances
later.

You can use db2 get dbm cfg | grep SVCENAME to retrieve the service names and
then check the /etc/services for the equivalent port values to open on your
firewall.
-----------------------------------------------------------------------------

8. Installing DB2 Express-C on Fedora Core 6

Before proceeding, please ensure that you have read Section 5 and Section 6
.

Note that IBM does not officially support this distribution for DB2 9. Any
problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the issue. See
the DB2 Linux validation website in Section 22.

These installation notes are based on a single-partition 32-bit installation
using the 2.6.18-1.2849.fc6 kernel.
-----------------------------------------------------------------------------

8.1. Installation notes

The only installation error encountered was found when launching the ./
db2setup command. The screen displayed this error:
ERROR:
The following library files could not be loaded by db2langdir
in /tmp/exp/disk1/db2/linux/install/../bin

libstdc++.so.5
libstdc++.so.5

Check the following web site for the up-to-date system
requirements of IBM DB2 Version 9.1:
http://www.ibm.com/software/data/db2/udb/sysreqs.html

Aborting the current installation ...
To resolve this error, use the yum package utility to install the necessary
C++ compatibility libraries:
yum -y install compat-libstdc++-33
Installation succeeded after installing the C++ libraries.
-----------------------------------------------------------------------------

8.2. Post-installation notes

Test results (see Section 21 for more details) were successful, except the
Configuration Assistant was very slow when launched from the DB2 Control
Center. I eventually had to kill the process and it returned a DB2JAVIT : RC
= 143 return code.

One strange effect encountered was that DB2 windows were not showing up when
launching the Java-based GUI tools (and other windows were missing window
decoration); however, logging off and then back in again solved the problem.

To inherit the DB2 instance environment from another home directory, create
databases, dynamically load the DB2 libraries, and other tasks, I found that
I had to either disable SELinux or modify the default SELinux policies. You
can disable SELinux at run-time by running the following command as root:
# /usr/sbin/setenforce 0
Note that when you reboot SELinux will be enabled again. To disable SELinux
permanently, edit /etc/selinux/config and set the following value:
SELINUX=disabled

If you have enabled your firewall (using the iptables service), and you want
to enable external connectivity to your DB2 server, you must open up ports
523 and any DB2 service ports (use db2 get dbm cfg | grep SVCENAME to
retrieve the service names and check /etc/services for the equivalent port
values) in your firewall.
-----------------------------------------------------------------------------

9. Installing DB2 Express-C on Fedora 7

Before proceeding, please ensure that you have read Section 5 and Section 6
.

Note that IBM does not officially support this distribution for DB2 9. Any
problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the issue.

These installation notes are based on a single-partition 32-bit installation
using the 2.6.21-1.3228.fc7 kernel.
-----------------------------------------------------------------------------

9.1. Installation notes

The only installation error encountered was found when launching the ./
db2setup command. The screen displayed this error:
ERROR:
The following library files could not be loaded by db2langdir
in /tmp/exp/disk1/db2/linux/install/../bin

libstdc++.so.5
libstdc++.so.5

Check the following web site for the up-to-date system
requirements of IBM DB2 Version 9.1:
http://www.ibm.com/software/data/db2/udb/sysreqs.html

Aborting the current installation ...
To resolve this error, use the yum package utility to install the necessary
C++ compatibility libraries:
yum -y install compat-libstdc++-33
Installation succeeded after installing the C++ libraries.
-----------------------------------------------------------------------------

9.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the iptables-based firewall (which is
enabled by default), it was necessary to modify the iptables firewall
ruleset, which is kept in the /etc/sysconfig/iptables file. If you have
enabled your firewall (using the iptables service), and you want to enable
external connectivity to your DB2 server, you must open up TCP and UDP access
to ports 523 and TCP access to any DB2 service ports. To make this work, add
these rules to the iptablesfile (anywhere amongst the -j ACCEPT rules):
-A RH-Firewall-1-INPUT -p udp -m udp --dport 523 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 523 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 50000 -j ACCEPT
These rules were added directly to the iptables file to ensure that they
persist in case of a system reboot. Note that you will need to add another
new TCP rule to allow firewall access if you create any additional instances
later.

You can use db2 get dbm cfg | grep SVCENAME to retrieve the service names and
then check the /etc/services for the equivalent port values to open on your
firewall.
-----------------------------------------------------------------------------

10. Installing DB2 Express-C on OpenSUSE 10.2

Before proceeding, please ensure that you have read Section 5 and Section 6.

Note that IBM does not officially support this distribution for DB2 9. Any
problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the issue.

These installation notes are based on a single-partition installation using
the 2.6.18.2-34-default kernel.
-----------------------------------------------------------------------------

10.1. Installation notes

The installation on OpenSUSE 10.2 completed successfully, with no problems
getting the GUI installer working, and no errors during the install.
-----------------------------------------------------------------------------

10.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the firewall (which is enabled by default),
it was necessary to add the port values to the firewall using the YaST2
utility.

You can use the db2 get dbm cfg | grep SVCENAME command to retrieve the DB2
instance service name. By default, this is set as a TCP connection at port
50001. Note that you will need to add another new TCP rule to allow firewall
access if you create any additional instances later. If you want to remotely
administer the DB2 installation on this system, the UDP and TCP connections
at port 523 should also be allowed through the firewall.

To open these ports using YaST, open the YaST tool, and select "Security and
Users, then select the "Firewall" icon. In the Allowed Services setup panel,
click on the "Advanced" button. In the TCP ports dialog, add 523 50001, and
in the UDP ports dialog, add 523. Click "Next" until the setup wizard
completes and restarts the firewall. Remote connections will now pass through
to the DB2 instance.
-----------------------------------------------------------------------------

11. Installing DB2 Express-C on SUSE Linux Enterprise Server (SLES) 9

Before proceeding, please ensure that you have read Section 5 and Section 6.

These installation notes are based on a single-partition installation using
the 2.6.5-7.97-default kernel.
-----------------------------------------------------------------------------

11.1. Installation notes

The installation on SLES 9 completed successfully, with no problems getting
the GUI installer working, and no errors during the install. This smooth
installation isn't surprising, given that SLES 9 is an officially supported
platform for DB2.
-----------------------------------------------------------------------------

11.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the firewall (which is enabled by default),
it was necessary to add the port values to the firewall using the YaST
utility.

You can use the db2 get dbm cfg | grep SVCENAME command to retrieve the DB2
instance service name. By default, this is set as a TCP connection at port
50001. Note that you will need to add another new TCP rule to allow firewall
access if you create any additional instances later. If you want to remotely
administer the DB2 installation on this system, the UDP and TCP connections
at port 523 should also be allowed through the firewall.

To open these ports using YaST, open the YaST tool, and select "Security and
Users, then select the "Firewall" icon. In the setup panel, click "Next" and
then on the "Expert button. In the ports dialog, add 523 50001. Click "Next"
until the setup wizard completes and then "Continue" so that YaST will
restart the firewall with the new configuration. Remote connections will now
pass through to the DB2 instance.
-----------------------------------------------------------------------------

12. Installing DB2 Express-C on SUSE Linux Enterprise Server (SLES) 10

Before proceeding, please ensure that you have read Section 5 and Section 6.

These installation notes are based on a single-partition installation using
the 2.6.16.21-0.8-default kernel. Novell AppArmor security was installed and
enabled during the installation and testing.
-----------------------------------------------------------------------------

12.1. Installation notes

The installation on SLES 10 completed successfully, with no problems getting
the GUI installer working, and no errors during the install. This smooth
installation isn't surprising, given that SLES 10 is an officially supported
platform for DB2.
-----------------------------------------------------------------------------

12.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the firewall (which is enabled by default),
it was necessary to add the port values to the firewall using the YaST2
utility.

You can use the db2 get dbm cfg | grep SVCENAME command to retrieve the DB2
instance service name. By default, this is set as a TCP connection at port
50001. Note that you will need to add another new TCP rule to allow firewall
access if you create any additional instances later. If you want to remotely
administer the DB2 installation on this system, the UDP and TCP connections
at port 523 should also be allowed through the firewall.

To open these ports using YaST, open the YaST tool, and select "Security and
Users, then select the "Firewall" icon. In the Allowed Services setup panel,
click on the "Advanced" button. In the TCP ports dialog, add 523 50001, and
in the UDP ports dialog, add 523. Click "Next" until the setup wizard
completes and restarts the firewall. Remote connections will now pass through
to the DB2 instance.
-----------------------------------------------------------------------------

13. Installing DB2 Express-C on SUSE Linux Enterprise Desktop 10

Before proceeding, please ensure that you have read Section 5 and Section 6.

These installation notes are based on a single-partition installation using
the 2.6.16.21-0.25 kernel.
-----------------------------------------------------------------------------

13.1. Installation notes

The installation on SLED 10 completed successfully, with no problems getting
the GUI installer working, and no errors during the install.
-----------------------------------------------------------------------------

13.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the firewall (which is enabled by default),
it was necessary to add the port values to the firewall using the YaST2
utility.

You can use the db2 get dbm cfg | grep SVCENAME command to retrieve the DB2
instance service name. By default, this is set as a TCP connection at port
50001. Note that you will need to add another new TCP rule to allow firewall
access if you create any additional instances later. If you want to remotely
administer the DB2 installation on this system, the UDP and TCP connections
at port 523 should also be allowed through the firewall.

To open these ports using YaST, open the YaST tool, and select "Security and
Users, then select the "Firewall" icon. In the Allowed Services setup panel,
click on the "Advanced" button. In the TCP ports dialog, add 523 50001, and
in the UDP ports dialog, add 523. Click "OK" and then "Next" until the setup
wizard completes and restarts the firewall. Remote connections will now pass
through to the DB2 instance.
-----------------------------------------------------------------------------

14. Installing DB2 Express-C on Mandriva Linux 2007

Before proceeding, please ensure that you have read Section 5 and Section 6
.

Note that IBM does not officially support this distribution for DB2 9. Any
problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the issue.

These installation notes are based on a single-partition installation using
the 2.6.17-5mdvlegacy kernel.
-----------------------------------------------------------------------------

14.1. Installation notes

Note that root logins are not allowed in Mandriva, so you will need to log on
as another user, then run the su -l command from a terminal session to gain
root access before you launch the ./db2setup command.

The only installation error encountered was found when launching the ./
db2setup command. The screen displayed this error:
ERROR:
The following library files could not be loaded by db2langdir
in /tmp/exp/disk1/db2/linux/install/../bin

libstdc++.so.5
libstdc++.so.5

Check the following web site for the up-to-date system
requirements of IBM DB2 Version 9.1:
http://www.ibm.com/software/data/db2/udb/sysreqs.html

Aborting the current installation ...
To resolve this error, use the drakrpm package utility to install the
necessary C++ compatibility libraries:
libstdc++5-3.3.6-3mdk
libstdc++6-4.1.1-3mdk
Installation succeeded after installing the C++ libraries.
-----------------------------------------------------------------------------

14.2. Post-installation notes

Basic test results (see Section 21 for more details) were successful.

However, I found that after a reboot, the DB2 instance was not being
restarted automatically, so clients could not connect to the database. To
correct this problem, execute this command as the instance owner:
db2set DB2AUTOSTART=YES
This will ensure that the DB2 instance is initialized and ready to receive
incoming connections after a reboot (intentional or otherwise).

Also, to allow DB2 access through the firewall (which is enabled by default),
it was necessary to modify the add in the appropriate firewall ports. To
enable external connectivity to your DB2 server, you must open up TCP and UDP
access to ports 523 and TCP access to the DB2 instance port (50001 by
default).

Open the Mandriva Control Center, choose the Security tab, and then the "
Set up a personal firewall..." icon. In the firewall setup panel, click the "
Advanced button and add 523/udp 523/tcp 50001/tcp to the Other ports text
box. Click "OK until the firewall setup is complete.

Note that you will need to add another new TCP rule to allow firewall access
if you create any additional instances later.
-----------------------------------------------------------------------------

15. Installing DB2 Express-C on Ubuntu 6.06 LTS 'Dapper Drake'

Before proceeding, please ensure that you have read Section 5 and Section 6
.

These installation notes are based on a single-partition installation using
the 2.6.15-17 kernel.
-----------------------------------------------------------------------------

15.1. Installation notes

Since you cannot log in as root directly with an Ubuntu system, this DB2
installation is run as the default user created during Ubuntu setup (i.e. the
regular user account with 'sudo' capability).

There are two ways of installing DB2 Express-C 9 on Ubuntu. The harder of the
two methods is to use the default DB2 db2setup, and then make adjustments to
the Ubuntu system afterwards to handle the slight differences of Ubuntu's
Debian-based packaging system. For reasons of clarity and brevity, I will
omit the instructions for doing it this more difficult way; however, if you
would like to see these instructions, please send me an email
(db2howto@gmail.com) and I will pass them along.

The easy way to install DB2 Express-C on Ubuntu 6.06 LTS is to use the
Synaptic package installer, and almost everything is done for you, from
downloading to installation and configuration. Here's how to do it:

1. Under the Applications menu on the Ubuntu menu bar, choose Add/Remove.

2. Once the Synaptic package manager application has started up, click the
Show commercial applications checkbox.

3. In the Search bar, type "DB2" and hit the Enter key.

4. DB2 Express should show up as the only result. If you don't see it, make
sure that Synaptic is displaying All Applications or Third party
applications.

5. Enable the dapper-commercial channel if requested by clicking the "Enable
channel" button.

6. Click "Apply".


After hitting the "Apply" button, Synaptic will download the DB2 Express-C
package, along with a few dependent libraries, then unpack and install the
package and finally configure the DB2 users and default instance.
-----------------------------------------------------------------------------

15.2. Post-installation notes

After installation by Synaptic, there are a few steps required to get DB2 up
and running smoothly.

1. Usable passwords for the DB2 default accounts.

To actually log in or connect to the DB2 databases and servers using the
default DB2 users (db2inst1, db2fenc1, and dasusr1), you need to modify
the initial passwords. To do this, open a terminal (as the regular user),
and type sudo su - to get root access. Then run these three commands:
passwd db2inst1
passwd db2fenc1
passwd dasusr1
Each time you will be asked to set the new password for the specified
user account.

2. Change the default shell for the DB2 default accounts.

The default command shell for the DB2 accounts is set as just a plain old
/bin/sh. To get the handy features of the BASH shell, you'll want to
change it for these three accounts. In the same root access command
window, open the /etc/passwd file in your favorite text editor and
change:
db2inst1:x:1001:1001::/home/db2inst1:/bin/sh
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/sh
dasusr1:x:1003:1003::/home/dasusr1:/bin/sh
to
db2inst1:x:1001:1001::/home/db2inst1:/bin/bash
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/bash
dasusr1:x:1003:1003::/home/dasusr1:/bin/bash

3. Enable DB2 service ports for remote connections.

To enable outside users to get to your DB2 databases, you'll need to set
up the DB2 service port, as it is not configured by the Synaptic
installation process.

As the regular user, run sudo vi /etc/services and add this line to the
end of the file and save the changes:
db2c_db2inst1 50001/tcp # IBM DB2 instance - db2inst1
Then, as the DB2 instance owner (db2inst1 by default), run these
commands:
db2 update dbm cfg using SVCENAME db2c_db2inst1
db2set DB2COMM=tcpip
db2stop
db2start
Now remote users will be able to connect to the DB2 databases on your
Ubuntu system.

4. Enable remote DB2 administration connections.

To allow remote administration of your DB2 server, you'll need to set up
the DB2 DAS connection port, as it is not configured by the Synaptic
installation process.

As the regular user, run sudo vi /etc/services and add this line to the
end of the file:
ibm-db2 523/tcp # IBM DB2 DAS
ibm-db2 523/udp # IBM DB2 DAS
Then, as the DB2 DAS owner (dasusr1 by default), run these commands:
db2admin stop
db2admin start
Now remote administrators can connect to the DAS server to administer
databases on your Ubuntu system.


-----------------------------------------------------------------------------
16. Installing DB2 Express-C on Ubuntu 7.04 'Feisty Fawn'

These installation notes are based on a single-partition installation using
the 2.6.20-16-generic kernel.

Note that IBM does not yet officially support this distribution for DB2 9.
Any problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the issue.

Also be aware that the PowerPC architecture is no longer supported in Ubuntu
7.04 and later.
-----------------------------------------------------------------------------

16.1. Installation notes

Since you cannot log in as root directly with an Ubuntu system, this DB2
installation is run as the default user created during Ubuntu setup (i.e. the
regular user account with 'sudo' capability).

There are two ways of installing DB2 Express-C 9 on Ubuntu. The harder of the
two methods is to use the default DB2 db2setup, and then make adjustments to
the Ubuntu system afterwards to handle the slight differences of Ubuntu's
Debian-based packaging system. For reasons of clarity and brevity, I will
omit the instructions for doing it this more difficult way; however, if you
would like to see these instructions, please send me an email
(db2howto@gmail.com) and I will pass them along.

The easy way to install DB2 Express-C on Ubuntu 7.04 is to download the DB2
Express-C Debian package file and then use the Ubuntu package installer. This
way, almost everything is done for you, from installation to configuration.
Here's how to do it:

1. Use any FTP client software and connect to: [] ftp.software.ibm.com/
software/data/db2/express/latest_debs

2. Download db2exc_9.1.2-1_i386.deb (or the latest equivalent .deb file)

3. Once the download is complete, run this command:
sudo gdebi-gtk db2exc_9.1.2-1_i386.deb

4. Click "Install Package"

5. Click "Close" once the package has been installed


After hitting the "Install Package" button, the Ubuntu package installer will
unpack and install the package and configure the DB2 users and default
instance. Click the "Close" button once the installation is complete.
-----------------------------------------------------------------------------

16.2. Post-installation notes

After installation by Synaptic, there are a few steps required to get DB2 up
and running smoothly.

1. Usable passwords for the DB2 default accounts.

To actually log in or connect to the DB2 databases and servers using the
default DB2 users (db2inst1, db2fenc1, and dasusr1), you need to modify
the initial passwords. To do this, open a terminal (as the regular user),
and type sudo su - to get root access. Then run these three commands:
passwd db2inst1
passwd db2fenc1
passwd dasusr1
Each time you will be asked to set the new password for the specified
user account.

2. Change the default shell for the DB2 default accounts.

The default command shell for the DB2 accounts is set as just a plain old
/bin/sh. To get the handy features of the BASH shell, you'll want to
change it for these three accounts. In the same root access command
window, open the /etc/passwd file in your favorite text editor and
change:
db2inst1:x:1001:1001::/home/db2inst1:/bin/sh
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/sh
dasusr1:x:1003:1003::/home/dasusr1:/bin/sh
to
db2inst1:x:1001:1001::/home/db2inst1:/bin/bash
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/bash
dasusr1:x:1003:1003::/home/dasusr1:/bin/bash

3. Enable DB2 service ports for remote connections.

To enable outside users to get to your DB2 databases, you'll need to set
up the DB2 service port, as it is not configured by the Synaptic
installation process.

As the regular user, run sudo vi /etc/services and add this line to the
end of the file:
db2c_db2inst1 50001/tcp # IBM DB2 instance - db2inst1
Then, as the DB2 instance owner (db2inst1 by default), run these
commands:
db2 update dbm cfg using SVCENAME db2c_db2inst1
db2set DB2COMM=tcpip
db2stop
db2start
Now remote users will be able to connect to the DB2 databases on your
Ubuntu system.

4. Enable remote DB2 administration connections.

To allow remote administration of your DB2 server, you'll need to set up
the DB2 DAS connection port, as it is not configured by the Synaptic
installation process.

As the regular user, run sudo vi /etc/services and add this line to the
end of the file:
ibm-db2 523/tcp # IBM DB2 DAS
ibm-db2 523/udp # IBM DB2 DAS
Then, as the DB2 DAS owner (dasusr1 by default), run these commands:
db2admin stop
db2admin start
Now remote administrators can connect to the DAS server to administer
databases on your Ubuntu system.

5. Correct instance restart problem

One issue of note with the Ubuntu 7.04 installation is that the DB2
instances do not properly restart after a system reboot, and setting
DB2AUTOSTART=YES does not resolve the issue.

One workaround to this problem was suggested in part by IgorM on the DB2
Express-C forum; and that is to create and execute your own DB2 instance
start up script.

To begin with, login and create a new script file using the command:
sudo vi /etc/init.d/db2
and then insert this text:
#!/bin/sh
#
# Script to start DB2 instances on bootup.
#
set -e

. /lib/lsb/init-functions

case "$1" in
start)
/opt/ibm/db2exc/V9.1/instance/db2istrt
;;
stop|restart|reload)
;;
esac

exit 0
and write the file to disk with the :wq vi command.

Note that the path to the executable is /opt/ibm/db2exc/V9.1/, the
default installation path from the DB2 .deb file. If your installation
put the DB2 files elsewhere, be sure to adjust this script as required to
find the /instance/ directory.

Once the script has been saved, give the file the proper ownership and
permissions:
chown root.root db2
chmod 755 db2

Now, to initialize this script so that it starts at boot time, install
the Boot-Up Manager with this command:
sudo apt-get bum

After Synaptic downloads and installs the application file, you can run
the program by clicking System -> Administration -> BootUp-Manager. Then
click on the "Activate" checkbox beside the db2 entry. Click Apply and
say "No" to the dialog that asks if you want to start the service now.
Click Quit. The script will now run at your next boot and start up all
DB2 instances.

The only other way to resolve the problem is to manually start the
instances after a reboot with db2start (as the instance owner) and
db2admin start (as the DAS owner). Once DB2 Express-C has passed the
validation process for Ubuntu 7.04, this instance start issue will
disappear.


-----------------------------------------------------------------------------
17. Installing DB2 Express-C on SimplyMEPIS 6.0

SimplyMEPIS 6.0 is based on the Ubuntu package management system and
repositories, and is currently amongst the top 5 Linux distributions
(according to distrowatch.com). In 6.0, SimplyMEPIS only supports the 32-bit
architecture, but the new release, 6.5, supports the 64-bit architecture.

Note that IBM does not officially support this distribution for DB2 9. Any
problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the issue.

These installation notes are based on a single-partition 32-bit installation
using the 2.6.15-26.386 kernel.
-----------------------------------------------------------------------------

17.1. Installation notes

No problems were encountered during the default installation.
-----------------------------------------------------------------------------

17.2. Post-installation notes

After installation, I could not create the SAMPLE database, or any database
for that matter. DB2 returned this strange error:
SQL0440N No authorized routine named RTRIM of
type "FUNCTION" having compatible arguments was found
I then rebooted and logged back in as root, then opened a terminal session:
su - db2inst1
db2sampl
and then SAMPLE database creation worked as expected. After this, I logged
out as root, then back in as db2inst1 and all DB2 tests completed
successfully.

If you want to enable external connectivity to your DB2 server, you must open
up ports 523 and any DB2 instance services (use db2 get dbm cfg | grep
SVCENAME to retrieve the service names and check /etc/services for the
equivalent port values) in your firewall.
-----------------------------------------------------------------------------

18. Installing the DB2 Information Center

The DB2 Information Center delivers the DB2 product documentation inside an
Eclipse-based help system, and provides a convenient way to search and
utilize the DB2 documentation.
-----------------------------------------------------------------------------

18.1. Installing the Information Center locally

To begin, mount the DB2 Information Center CD in your system drive, or if you
downloaded the compressed file through the Express-C website, expand the
tarball containing the installation utilities.

Change to the base directory (doce/disk1/) and run the db2setup utility. This
will launch the DB2 setup wizard. You can also use the other setup methods,
but since the GUI installation sets up and configures everything for you,
it's the method I recommend.

Installation Steps:

1. Select the "Install a Product" option from the launcher, and then click
the "Install New" button in the main panel.

2. Read the description and click "Next".

3. Read the license agreement, and if you agree, select "Accept" and click
"Next".

4. By default, the installation script will install the Information Center
locally and generate a response file. The choice is up to you, but we're
only doing a local install, so choose the "Install DB2 Information Center
on this computer" option instead. Click "Next".

5. Add any additional languages that you want to have installed. English is
installed by default and cannot be deselected. Each additional language
will add anywhere from 5 MB to 50 MB to the installation size. Click
"Next".

6. The next panel is where things get a little interesting. Here you can
specify the service name that the Information Center will run under. An
entry will be added to the /etc/services file for this service. You
probably don't need to change this, unless you have another service
running as "db2icv91".

Also, this panel is where you specify the system port that the
Information Center will use to serve up the documentation. By default,
this is port 51000.

These settings will change the configuration for all DB2 products
installed on the local system, so that their help system will use the
parameters you define here. Click "Next".

7. Read the summary of what will be done, then click "Finish" to start the
file installation


-----------------------------------------------------------------------------
18.1.1. Post-installation notes

You can change which directory the Information Center uses as a temporary
working directory. To do this, modify the DB2_ECLIPSEIC_DATA parameter in the
db2ic.conf file found in the /opt/ibm/db2ic/V9/cfg directory. The temporary
directory can be anywhere where the "bin" user can write to.

Also in this file, you can change the port used to serve up the Information
Center, in case you change your mind later on about the one you set up during
the install. Just change the DB2_ECLIPSEIC_PORT parameter to the new number
(though it must be a port under the maximum of 65535).

After making any changes, do a
/etc/init.d/db2icdv9 restart
to have your changes picked up by the Information Center (see below for more
details on the db2icd daemon).
-----------------------------------------------------------------------------

18.2. The Information Center daemon

The Information Center daemon is set up during installation and is used to
launch the background process that runs the Information Center. The daemon
script, named db2icdv9 is installed to the /etc/init.d/ directory, and start
up symbolic links are added to the /etc/init.d/rc.X/ run-level folders. By
default, the daemon is turned on for run-levels 3 and 5. You can modify these
run-levels with any system init utility (chkconfig, ntsysv, or any of the
X-based variants).

There are 5 commands you can pass to the daemon:

1. start ?? Starts the Information Center, using the configuration
parameters set in the /opt/ibm/db2ic/V9/cfg/db2ic.conf file.

2. stop ?? Halts a running Information Center.

3. restart ?? A combination command that stops, then starts the daemon
again.

4. reload ?? Same as restart.

5. status ?? Provides information on whether the Information Center is
running, and if it is running, what the process IDs (PID) are.


-----------------------------------------------------------------------------
18.3. Accessing an installed Information Center

There are three possible methods to access the DB2 Information Center:

* Via the publib.boulder.ibm.com Web site (this is the default option
enabled during a DB2 installation)

* Via an intranet machine that is hosting the DB2 Information Center within
your own organization

* Via an Information Center that is installed and set up on your local
machine


You can configure which access method will be used, either during the DB2
installation (only by specifying a "Custom" installation), or afterwards in
the tools configuration panel (in the GUI tools), or from the command line.

To make the change using the GUI tools (Control Center), open the Tools menu,
select Tools Settings, and then the Documentation tab. On this panel, you can
specify a host URL and port where an Information Center can be found. When
putting a hostname in, do not add the "http://" prefix, or any subdirectories
?? just type in the hostname, and the internal code will do the rest.

To change the access points from the command line, execute these commands:
db2set DB2_DOCHOST=host_URL
db2set DB2_DOCPORT=host_port
where host_URL is the location hostname of the Information Center. This could
be: mydocserver.myorg.net or localhost (for a local installation), and
host_port is the port number where the Information Center was installed.

By default, these DB2 environment settings are blank, which means that DB2
defaults to the http://publib.boulder.ibm.com/infocenter/db2help/ Web site.

To invoke the DB2 Information Center from the GUI tools, click on the "?"
icon in the toolbar, any of the "Help" hyperlinks or buttons, or by selecting
any of the menu items in the "Help" menu.

To invoke the DB2 Information Center from the command line, issue any of
these commands:

* db2icdocs
* db2help
* db2ic
* db2cc -ic

-----------------------------------------------------------------------------
19. Removing DB2 Express-C

Uninstalling DB2 Express-C is a bit more detailed than the installation
process. Unfortunately, at this time, there is no GUI-based uninstaller
utility like there is for installation. Follow the steps below to completely
remove the DB2 Express-C software from your system. Since the database files
are kept in the home directory of the instance user, you can keep the
database files by skipping the removal of the instance owner (the last step).

1. Remove the Database Administration Server. Switch to the DAS owner
(dasusr1 by default), either through the su - dasusr1 command or by
logging in to the system directly as the DAS user, and issue the command
db2admin stop. Then switch to the root user, and issue the /opt/ibm/db2/
V9.1/instance/dasdrop command.

2. Remove the DB2 instance(s). Switch to the instance owner (db2inst1 by
default), either through the su - db2inst1 command or by logging in to
the system directly as the instance user, and issue the command db2stop.
Then, as root, remove the instance by issuing the /opt/ibm/db2/V9.1/
instance/db2idrop db2_instance command, where db2_instance refers to the
actual instance name you want to drop (for example, /opt/ibm/db2/V9.1/
instance/db2idrop db2inst1). If you want to verify which instances are
present on your system, run the /opt/ibm/db2/V9.1/instance/db2ilist
command.

3. Remove the software installation. As root, run the /opt/ibm/db2/V9.1/
install/db2_deinstall -a command. This will remove the installation of
DB2 from your system.

4. If no longer need the DB2 database files (which are kept in the home
directory of the instance owner), you can remove the users that were
created during the installation of DB2 Express-C by entering these
commands as root:
userdel -r db2inst1
userdel -r dasusr1
userdel -r db2fenc1
(If you created different user names during installation, substitute as
necessary.)


-----------------------------------------------------------------------------
20. Using DB2

This section gives you the basic information you need to start working with
DB2 Express-C on Linux. It includes instructions on issuing DB2 commands and
SQL statements from the command line, as well as the commands you need to
start the DB2 Control Center and the DB2 Information Center. For more
information about general DB2 usage, please investigate the DB2 manuals and
Information Center.
-----------------------------------------------------------------------------

20.1. DB2 Control Center

To start the DB2 Control Center:

1. Ensure you are logged on to your Linux workstation using either the DB2
Administration Server user ID (dasusr1 by default) or the DB2 instance
user ID (db2inst1 by default). If you use the su command to change to one
of those users, ensure you include the -l parameter to initialize the
proper user environment.

2. Start the X server, if it is not already started.

3. Start a terminal session, or type Alt + F2 to bring up the Linux "Run
Command" dialog.

4. Type db2cc to start the DB2 Control Center.


The left side of the DB2 Control Center provides an object based view of the
database objects that you have catalogued, including DB2 instances and
databases on other DB2 servers.

One way to add, edit, or drop database objects is to right-click on the
object to bring up a context menu.
-----------------------------------------------------------------------------

20.2. DB2 Information Center

As mentioned above, the new DB2 Information Center is a revamped
documentation display system that now encapsulates the task, concept and
reference information required to properly run DB2 . It can be installed
locally, on an intranet server, or accessed directly from the ibm.com hosting
service.

To start the DB2 Information Center:

1. Ensure you are logged on to your Linux workstation using either the DB2
Administration Server user ID (dasusr1 by default) or the DB2 instance
user ID (db2inst1 by default). If you use the su command to change to one
of those users, ensure you include the -l parameter to initialize the
proper user environment.

2. Ensure that the X server is started, as the Information Center requires a
Web browser.

3. Issue one of the launch commands:

+ db2icdocs
+ db2help
+ db2ic
+ db2cc -ic


Alternatively, you can launch the Information Center from within the Control
Center (or any of the other GUI tools), by clicking an item under the "Help"
menu, or by clicking on the "?" (question mark) icon.

If you did not install the DB2 Information Center, or have not configured
your tools to use a different server, then these commands will launch a
detected browser, and take you directly to the IBM hosted DB2 Information
Center at [http://publib.boulder.ibm.com/infocenter/db2help/] http://
publib.boulder.ibm.com/infocenter/db2help/.
-----------------------------------------------------------------------------

20.3. DB2 command line processor (CLP)

If you are logged on to your Linux workstation using either the DB2
Administration Server user ID or the DB2 instance user ID, you can issue DB2
commands and SQL statements from the command line.

If this is your first time using DB2 , I would suggest creating the DB2
sample database. The sample database is used throughout the DB2 documentation
and is required by most of the sample applications.

To create the sample database, you can either select the Create the SAMPLE
database option from the DB2 First Steps launchpad, or by issuing the
db2sampl command from the command line.

Before you can issue an SQL statement, you have to connect to a database. To
connect to a database, enter the command:
db2 CONNECT TO database USER userID USING password

To connect to a database, and have DB2 prompt you for the password, issue the
command:
db2 CONNECT TO database USER userID

To connect to a database using the default user ID, issue the command:
db2 CONNECT TO database

Once you have connected to a database, you can then issue SQL statements or
DB2 commands against that database. For example, to select all of the rows
from the EMPLOYEE table in the SAMPLE database, issue this command:
db2 "SELECT * FROM employee"

You can avoid typing db2 as the prefix for every SQL statement and DB2
command by issuing DB2 commands using the Command Line Processor (CLP). To
start the CLP, issue the db2 command by itself from a Linux command line
terminal. DB2 provides the following prompt:
You can issue database manager commands and SQL statements
from the command prompt. For example:
db2 => connect to sample
db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
? CATALOG DATABASE for help on the CATALOG DATABASE command
? CATALOG for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 =>

Some users prefer to avoid the CLP because it prevents using the command line
history features of the shell.

Some users claim that running the CLP within an Emacs shell gives them the
best of both worlds: they get command line history, and they don't have to
escape commands that contain lots of quotation marks and brackets, but your
mileage may vary.
-----------------------------------------------------------------------------

21. Installation and operation test plan

-----------------------------------------------------------------------------
21.1. DB2 Express-C installation tests

1. Log on as root (or gain root access through a terminal if a root logon is
not available)

2. Mount the DVD (if installing from Discovery DVD set), or download the
appropriate Linux compressed image (tar.gz file) from the DB2 Express-C
download site

3. Copy the compressed image file to the /tmp directory

4. Extract the files from the compressed image, either using the Ark GUI
tool or using the console command tar zxvf db2exc_91_LNX_x86.tar.gz

5. Inside the /tmp folder, change to the exp/disk1i directory and run the
db2setup command:
./db2setup

6. In the DB2 setup Launchpad, choose Install a Product

7. Choose Install New

8. Click "Next"

9. Verify the license and change the radio button to Accept, then choose "
Next" to continue the installation

10. Choose a Typical installation and click "Next"

11. Verify the install path, or change it to some point on your system with
at least 470 MB free, click "Next"

12. Set up the DAS (DB2 Administration Server) owner account. You can use an
existing user, or set up a new one (the default user is 'dasusr1'). Click
"Next"
13. Create a DB2 instance. Click "Next"

14. Set up the DB2 instance owner account. Again, you can use an existing
user, or set up a new one (the default instance owner is 'db2inst1').
Click "Next"

15. Set up the DB2 fenced user account. Same as before, use an existing user
or set up a new one. Click "Next"

16. Click "Finish" to initiate the install

17. If there are any problems with the installation, it will show up in the
installation log (the log is also kept in the /tmp directory as
db2setup.log and db2setup.err)


-----------------------------------------------------------------------------
21.2. DB2 Express-C operation tests

1. Log in as the DB2 instance owner (db2inst1 by default)

2. Open a terminal and run 'db2sampl' to create the SAMPLE database

3. Test terminal based commands:

a. db2 connect to sample
b. db2 'select * from dept'

4. Test DB2 Control Center:

a. Open the control center with 'db2cc' command
b. Select the "Advanced" view
c. Verify the SAMPLE database is present under the "All databases" tab
d. Look at the contents of one of the SAMPLE database tables and views
(e.g. vphone)

5. Create TOOLS database:
db2 'create tools catalog TOOLS create new database TOOLSDB'

6. Launch DB2 Task Center:

a. Create a task that issues a simple query like "connect to sample;
select tabname from syscat.tables; connect reset;", schedule to run
now
b. Click on "show results", no errors should exist

7. Launch DB2 Journal: You should be able to see the results of the task you
ran in the task center from the Journal.

8. Test DB2 Configuration Assistant

a. Start Configuration Assistant from the Control Center, or with db2ca

b. You should see the SAMPLE database listed, if not, click View, then
Refresh.

c. Right click on the SAMPLE database, choose Change Database, then in
step 4 of the wizard, register the database as a CLI/ODBC source, and
catalog as system data source. Click Finish to commit the changes

d. Right click on the SAMPLE database again, and click on Test
Connection. Select all types (Standard (ODBC), CLI, JDBC), then type
in a userid and password, and click on Test Connection. Ensure all
tests are successful.


9. Test DB2 trace facility: db2trc on -- check for positive response, then
run db2trc off

10. Test DB2 problem determination facility: db2pd -db sample > sample.txt
(examine output for errors)

11. Test DB2 license: db2licm -l should return:
Product name: "DB2 Express Edition"
License type: "Unwarranted"
Expiry date: "Permanent"
Product identifier: "db2exp"
Version information: "9.1"
Max number of CPUs: "2"


12. Test db2dart:
db2 force applications all
db2dart sample
(should report that DB2DART processing has completed successfully)

13. Test db2look facility: db2look -d sample -e > sample.ddl (should complete
successfully)

14. Test remote connections:

a. Create connection through command prompt on DB2 remote client system:
db2 catalog tcpip node test remote computername server 50001
db2 catalog db sample at node test

b. From remote machine:
db2 connect to sample
db2 "select * from dept"


15. Reboot server and retest via remote connection (to verify DB2 instance
autostart and that any firewall changes stick)


-----------------------------------------------------------------------------
22. Resources

This section lists available additional resources for information on using
DB2 Express-C 9 for Linux:
-----------------------------------------------------------------------------

22.1. Forums and Newsgroups

* IBM developerWorks forums

[http://www.ibm.com/developerworks/forums/db2_forums.jsp] http://
www.ibm.com/developerworks/forums/db2_forums.jsp

This page lists the available developerWorks hosted web forums. Many of
them are mirrors of the regular Usenet DB2 newsgroups.

* DB2 Express-C developerWorks forum

[http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=805&cat=81]
http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=805&cat=81

The main site for DB2 Express-C support questions. All support
functionality for unwarranted versions of Express-C comes from this
community support forum. Lots of IBM developers (including the DB2
Express-C team) regularly monitor and participate in this forum.

* DB2 9 developerWorks forum

[http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=842&cat=81]
http://www.ibm.com/developerworks/forums/dw_forum.jsp?forum=842&cat=81

The forum for general DB2 9 questions. Lots of DB2 developers regularly
monitor and participate in this forum.

* comp.databases.ibm-db2

Covers the use of DB2 on all platforms, including Linux and UNIX,
Windows, z/OS, iSeries, and pSeries. This forum is quite active.

* ibm.software.db2.udb

Similar to comp.databases.ibm-db2, but handles questions specific to the
DB2 Universal Database product only.


-----------------------------------------------------------------------------
22.2. Web sites

* DB2 Universal Database for Linux

[http://www.ibm.com/software/data/db2/linux/] http://www.ibm.com/software
/data/db2/linux

The home portal for DB2 information on Linux.

* DB2 Express-C

[http://www.ibm.com/software/data/db2/express/] http://www.ibm.com/
software/data/db2/express

Main web portal for the DB2 Express-C product, including downloads of the
DB2 Express-C software and related utilities.

* DB2 Information Center

[http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp] http://
publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp

The DB2 Information Center is the most current source of official DB2
documentation in 29 different languages. Set your browser language
preference and the site will return the translated version of a given
page if it is available, falling back to English content if not. Access
to the information is offered via search, navigation tree, or a
comprehensive [http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/
com.ibm.db2.udb.doc/doc/r0024231.htm] master index.

* DB2 Linux validation site

[http://www.ibm.com/software/data/db2/linux/validate/] http://
www.ibm.com/software/data/db2/linux/validate/

Information regarding IBM recommended and validated Linux distributions
for the current version of DB2.

* DB2 Online Support

[http://www.ibm.com/software/data/db2/udb/support.html] http://
www.ibm.com/software/data/db2/udb/support.html

The official support channel for DB2 for Linux, UNIX and Windows.
Contains information and downloads regarding Fixpaks, APARs, Technotes,
DB2 Flashes, and more.

* DB2 PDF Manuals

[http://www-1.ibm.com/support/docview.wss?rs=71&uid=swg27009552] http://
www-1.ibm.com/support/docview.wss?rs=71&uid=swg27009553

If you like your information in discrete chunks, this is the place to get
official DB2 manuals in PDF format.

* DB2 for Linux white papers

[http://www.ibm.com/software/data/db2/linux/papers.html] http://
www.ibm.com/software/data/db2/linux/papers.html

White papers typically provide overviews or introductions to new
technology or new releases of a product.

* DB2 Magazine

[http://www.db2mag.com] http://www.db2mag.com

This Web site is the online version of DB2 Magazine, which publishes
articles about using DB2 on Linux and other platforms. You can also sign
up for a free subscription to the print version of the magazine.

* IBM developerWorks for DB2

[http://www.ibm.com/developerworks/db2/] http://www.ibm.com/
developerworks/db2/

A great resource for tutorials, learning resources, help, and tips for
improving DB2 and developing DB2-based applications.

* International DB2 Users Group (IDUG)

[http://www.idug.org/wps/portal/idug] http://www.idug.org

IDUG holds a number of international conferences on DB2 and has regional
user groups. While IDUG has traditionally focused on DB2 for z/OS and
iSeries, they have increasingly included information on DB2 for Linux,
UNIX, and Windows. The IDUG Web site includes online discussion forums
and links to other DB2 resources.

* Red Hat Linux

[http://www.redhat.com] http://www.redhat.com

Home to the Red Hat Linux distribution.

Also see [http://www.redhat.com/rhn/] http://www.redhat.com/rhn/(the Red
Hat Network) for more information on system updates and kernel
information.

* SUSE Linux

[http://www.novell.com/linux/] http://www.novell.com/linux/

Now a Novell business, this site is the home for the SUSE Linux
distribution.

Also see [http://support.novell.com/patches.html] http://
support.novell.com/patches.html for more information on system updates
and kernel information.

* Ubuntu Linux

[http://www.ubuntu.com/] http://www.ubuntu.com/

Home to the Ubuntu Linux distribution.

Ubuntu is a community developed, Linux-based operating system that is
rapidly emerging as a favorite distributions, particularly amongst new
users.

* Fedora Project

[http://fedoraproject.org/] http://fedoraproject.org/

Home to the Fedora Project Linux distribution.

The Fedora Project is a collection of projects sponsored by Red Hat and
developed as a partnership between the open source community and Red Hat
engineers.

* Mandriva Linux

[http://www.mandriva.com/] http://www.mandriva.com/

Home to the Mandriva Linux distributions.

Mandriva's key product is the Mandriva Linux distribution. It is
available in individual user and enterprise versions. The company also
provides and maintains a completely free version called Free Mandriva.