Install DB2 on Fedora

This guide describes how to install DB2 Express-C 9.7 on Fedora Linux 10. It may be useful for later versions as well.

Perform preinstallation tasks

Read the installation requirements for DB2 servers. The most relevant steps are highlighted below.

Install required packages
# yum install libaio compat-libstdc++-33
Tune kernel parameters
# emacs /etc/sysctl.conf
# 32MB is the default shared memory max size
# DB2 states the minimum required is 256MB
kernel.shmmax = 268435456

# Default semaphore limits are:
# SEMMSL SEMMNS SEMOPM SEMMNI
# 250    32000  32     128
# DB2 suggests the number of arrays be raised to 1024
kernel.sem=250 256000 32 1024

# 8192 is the default message max size
# default queue max size is 16384
# DB2 recommends both limits be raised to 64KB
kernel.msgmax = 65535
kernel.msgmnb = 65535

Be sure to apply the changes.

# sysctl -p

Download installation packages

Look for DB2 Express-C 9.7 for Linux. Get the language pack if you are interested in localizing your server.

 

Extract the database package first; it contains a single expc directory. Afterwards, extract the language pack to expc.

$ tar -xzf db2exc_970_LNX_x86.tar.gz
$ tar -xzf db2exc_nlpack_970_LNX_x86.tar.gz -C expc/

Run installer

Execute the setup program as root.

Suggestion: save a response file when given the choice

# expc/db2setup [-r db2expc.rsp]

You can find a sample response file attached to the present guide. A few salient properties taken from this file are described next.

 

PropertyDescriptionValue
DAS_USERNAMEAcount for DB2 administration serverdasusr
INSTANCEPrefix for DB2 instance propertiesinst1
inst1.NAMEAccount for DB2 instance ownerdb2inst
inst1.HOME_DIRECTORYHome directory for DB2 instance/opt/ibm/db2/inst
inst1.PORT_NUMBERPort number for DB2 instance50000
inst1.FENCED_USERNAMEAccount for DB2 fenced userdb2fenc

Start DB2 administration server

Log in as dasusr. Use the db2admin command to control the administration server.

[dasusr]$ db2admin start
[dasusr]$ db2admin stop

Start DB2 instance

Log in as db2inst. Use the commands below to control the instance.

[db2inst]$ db2start
[db2inst]$ db2stop

Create database

[db2inst]$ db2 create database jbpm3 [on /var/lib/db2]

If the on <path> clause is absent, DB2 creates the database on the instance home directory.

Create login

DB2 delegates authentication to the operating system. Hence creating a database account amounts to adding a Linux user.

# useradd --system jbpm3
# passwd jbpm3

Authorization privileges are stored in DB2 system tables. DB2 defines an internal group called PUBLIC. Any authenticated user is implicitly a member of the PUBLIC group. Upon database creation, certain privileges are granted to PUBLIC automatically:


        •    CONNECT
        •    CREATETAB
        •    IMPLICIT SCHEMA
        •    BINDADD

 

Permission to connect to the database and create tables is all the jBPM test suite requires. No further privileges need to be granted to jbpm3.

Create tables

Connect to the database as the user created in the previous step.

[db2inst]$ db2 connect to jbpm3 user jbpm3
Enter current password for jbpm3: 
   Database Connection Information
 Database server        = DB2/LINUX 9.7.0
 SQL authorization ID   = JBPM3
 Local database alias   = JBPM3

Execute creation script.

[db2inst]$ db2 -tvf jbpm.jpdl.db2.sql
create table JBPM_ACTION
DB20000I  The SQL command completed successfully.
...

In this command:

  • -t indicates that statements use the default statement termination character (semicolon)
  • -v indicates verbose mode; causing db2 to echo the command being executed
  • -f  indicates that the filename specified after this flag is the script file

Terminate the connection.

[db2inst]$ db2 terminate
DB20000I  The TERMINATE command completed successfully.

Run DB2 as daemon

Download the attached db2 init script. Copy to the init.d directory and make it executable.

# cp db2 /etc/init.d
# chmod a+x /etc/init.d/db2

With the db2 script in place, you can start, stop, restart and query the status of the DB2 instance owned by db2inst with the service command.

# service db2 {start|stop|status|restart}

Use the chkconfig program to add the runlevel information for the new service.

# chkconfig --add db2

Now you can manage the service from system-config-services.