Yolinux.com Tutorial

IBM WebSphere (V4.0) J2EE applications server and DB2 (V7.2) database on Linux


This tutorial is covers the installation of the IBM DB2 Enterprise Database server and the IBM WebSphere J2EE middleware applications server (v4.0) products on Red Hat Linux 7.3. The tutorials covers the installation of these products on Linux from the "developerWorks" 2-CD set labeled: "Speed-start your Linux app - Software Evaluation Kit". First the IBM DB2 database is installed followed by the WebSphere Application server which then enable one to deploy your own J2EE applications or run the example applications shipped with the system.

The IBM developer two CD set is available from: http://www-106.ibm.com/developerworks/offers/linux-speed-start/?origin=lnxss_l

The WebSphere installation supports J2EE, XML (Extensible Markup Language), SOAP (Simple Object Access Protocol), WSDL (Web Services Description Language) and UDDI (Universal Description, Discovery and Integration). XML provides the data representation format, SOAP enables serving/accessing remote procedures (using XML over http), WSDL describes the names and properties of a web service (using XML), and UDDI provides a directory for the services.

It works best with about 0.5 Gig of memory.

Related YoLinux Tutorials:

°Java on Linux

°Java Log4j2 logging

°Java WAR files

°TomCat Tutorial

°YoLinux Tutorials Index

Free Information Technology Magazines and Document Downloads
TradePub link image

DB2 Database:

The goal here will be to install:

  • DB2 Database Admin Client
  • UDB (Universal DataBase) Enterprise Edition
  • Application Development Client (for writing your own applications)
and the sample database. The product "Connect Enterprise" will not be installed for this exapmle. (It enables connectivity with mainframe services)


  1. Check configuration:
    • Default language: echo $LANG
      For me this returned: en_US
    • Check if reguired packages are installed: rpm -e pdksh compat-libs ncurses4
      • The package pdksh ensures shell compatability with commercial ATT based Unix sytems.
      • The package compat-libs is for Red Hat 7.x+ systems to have Red Hat 6.x compatability.
      • Package ncurses4 provides terminal drivers and cursor control mechanism.
  2. Mount the CD (Disk 1 of 2): mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
    [Potential Pitfall]: At first I was lazy and issued the command: mount /mnt/cdrom which picks up system defaults and works for viewing CD contents. The problem was that this mounts the CD with privileges which allow for read only and does NOT allow one to execute scripts on the CD. Use the above (complete) command which will allow for the execution of scripts on the CD.
  3. Install DB2: (as root)
    • cd /mnt/cdrom/db72pf5u/
    • ./db2setup

      +----------------------------- DB2 Setup Utility ------------------------------+
      |                                                                              |
      |   Select Install to select products and their components to install, or      |
      |   select Create to create the DB2 services.                                  |
      |                                                                              |
      |                                                                              |
      |   To select products and their components, select           [ Install... ]   |
      |   Install.                                                                   |
      |                                                                              |
      |                                                                              |
      |   To create a DB2 Instance, an Administration Server,        [ Create... ]   |
      |   or a Data Links Manager Administrator select Create.                       |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |   [  Close  ]                                                   [  Help  ]   |

      Use the down arrow or tab key to migrate the menu. First select the "Install..." option to select the products to install. Next select the "Create..." option to create a DB2 Instance.

      After selecting the "Install..." option you will be presented with the following panel:

      +------------------------------- Install DB2 V7 -------------------------------+
      |                                                                              |
      |   Select the products you are licensed to install.  Your Proof of            |
      |   Entitlement and License Information booklet identify the products for      |
      |   which you are licensed.                                                    |
      |                                                                              |
      |   To see the preselected components or customize the selection, select       |
      |   Customize for the product.                                                 |
      |   :*: DB2 Administration Client                           [ Customize... ]   |
      |   :*: DB2 UDB Enterprise Edition                          [ Customize... ]   |
      |   [ ] DB2 Connect Enterprise Edition                      : Customize... :   |
      |   :*: DB2 Application Development Client                  [ Customize... ]   |
      |                                                                              |
      |   To choose a language for the following components, select Customize for    |
      |   the product.                                                               |
      |       DB2 Product Messages                                [ Customize... ]   |
      |       DB2 Product Library                                 [ Customize... ]   |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |                                                                              |
      |   [   OK   ]                     [ Cancel ]                     [  Help  ]   |

      Use the arrow (or tab) key to highlight a product selection. Use the space bar to toggle selection between [ ] and [*]. After the product has been selected, choose "Customize..." to add features.
      • DB2 Administration Client
        • :*: Java Support
        • :*: Control Center
      • DB2 UDB Enterprise Edition
        • :*: Java Support
        • :*: Replication
        • :*: Local Warehouse Control Database
        • :*: Distributed Join for DB2 Data Sources
        • :*: Getting Started
      • DB2 Application Development Client
        • :*: Java Support
        • :*: Control Center
        • :*: DB2 Sample Applications
        • :*: Create Links for DB2 Libraries
      • DB2 Product Library (by default no language is selected. Select one!)
        • Optional: DB2 Product Library (HTML):
          :*: en_US [ ] fr_FR [ ] de_DE
      Approve it by selecting OK.

      Next create a DB2 instance. The default will be db2inst1. A Linux user and home directory of the same name will be generated. You will be prompted for a password. I advise selecting "[Properties...]" to "Create a sample Database for the DB2 Instance".

      +----------------------------- DB2 Setup Utility ------------------------------+
      |                                                                              |
      |   +-- Status Report -----------------------------------------------------+   |
      |   |                                                                      |   |
      |   |                                                                      |   |
      |   |  The log file can be found in /tmp/db2setup.log.                     |   |
      |   |                                                                      |   |
      |   |                                                                      |   |
      |   |  Installation                                                        |   |
      |   |  ------------                                                        |   |
      |   |                                                                      |   |
      |   |  DB2 Client                                                 SUCCESS  |   |

The DB2 installation is complete.

What just happened?:

The installation created and started IBM DB2 database. The process will be running at this point. The following changes are made:

  • Three users (and home directories) are created:
    • db2as
    • db2fenc1
    • db2inst1
  • Additions to the file: /etc/services
    db2cdb2inst1    50000/tcp   # Connection port for DB2 instance db2inst1
    db2idb2inst1 50001/tcp # Interrupt port for DB2 instance db2inst1
  • Additions to the end of system init file: /etc/inittab
    Statement added to start DB2 upon system boot.
    Database start script added: /etc/rc.db2
  • DB2 database executables, libraries and support files: /usr/IBMdb2/V7.1/
  • The database instance is held in /home/Instance-name/...
  • Support files: /var/db2/v71/default.env and profiles.reg
  • Documentation: (local files which can be accessed after installation from CD)

Environment variables as configured by DB2 install program: (logged in as user db2inst1)

Environment Variable Value
DB2DIR /usr/IBMdb2/V7.1
DB2INSTANCE db2inst1
LD_LIBRARY_PATH :/home/db2inst1/sqllib/lib
LIBPATH :/home/db2inst1/sqllib/lib
CLASSPATH /home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/function:
PATH $PATH:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:

Test the database:

  • Log in as user db2inst1
    (i.e.: su - db2inst1)
  • Issue the command: db2
  • This will put you into the db2 environment and at the db2 command prompt.
    db2 => connect to sample
    db2 => select * from employee
    db2 => quit

Manage the database:

Commands used to manage the database: (login as user db2as)

  • Start DB2: db2start
    By default the installation will start the database and configure the system to start DB2 each time the system boots.
  • List database instances: db2ilist
  • List database release levels: db2level
  • Stop DB2: db2stop

As user db2inst1:

  • List Database Manager Configuration: db2 get dbm cfg
  • List System Database Directory: db2 list db directory
  • Generate sample database: db2sampl


  • The DB2 database will use TCP port 523.
  • DB2 License manager (execute as root): /usr/IBMdb2/V7.1/adm/db2licm
    Functionality available in Control Center (db2cc).

DB2 GUI management tool db2cc:

In order to use DB2 GUI management tools one must install the IBM Java run time environment. Login as DB2 administrative users db2as or db2inst1 and run the command db2cc (DB2 Control Center). It is important to add a JAVA_HOME statement to the environment file: /home/db2as/.bashrc or for user db2inst1. Help and documentation is also available from this panel or by initiating the command db2ic (Information Center).

WebSphere Aplication Server:


  1. Mount the CD (Disk 1 of 2): mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
  2. Create install directory:

    cd /tmp
    mkdir ws
    cd ws
    cp /mnt/cdrom/wasi401u/wasi401u.zip .
    unzip wasi401u.zip
    cd linux
    • This installation will install the HTTPD web server and the WebSphere applications server. IBM uses it's own installation of Apache and installs the appropriate modules. (I installed all modules available.)
    • The "IBM HTTP Server httpd.conf" configuration file requested during installation is /opt/IBMHTTPServer/conf/httpd.conf
      The Apache httpd.conf: /etc/httpd/conf/httpd.conf
      (This original default apache installation was not used in this tutorial.)
      This will add the statements:
      Alias /WSsamples /opt/WebSphere/AppServer/WSsamples
      LoadModule app_server_http_module /opt/WebSphere/AppServer/bin/mod_app_server_http.so
      WebSpherePluginConfig /opt/WebSphere/AppServer/config/plugin-cfg.xml
      AddModule mod_app_server_http.c
    • The installation program will start the web server.
    • [Potential Pitfall]: The installer launches a dialog box with the message "The installer was not able to determine that you have a supported Linux distribution." I ignored this message as it probably was unfamiliar with Red Hat version 7.3. It was probably expecting version 7.1.
    • Samples/examples will also be installed at this time.
  3. [Potential Pitfall]: The installation program fails to start the admin server. Start manually: /opt/IBMHTTPServer/bin/adminctl start
    Conversely use the argument stop to stop the server or restart to restart after a configuration change. Note:
    • The admin web server operates on port 8008.
    • The admin web server config file: /opt/IBMHTTPServer/conf/admin.conf
  4. Note: While the installation will start the web server, a system reboot will not. One may start the web server manually if necessary: /opt/IBMHTTPServer/bin/apachectl start
  5. Start the Netscape browser (I used 4.79). Java MUST be enabled. (Edit + Preferences + Advanced + "Enable Java") Enter the URL http://localhost/ and select "Configure server". (The password was assigned during installation - remember it!) Next select from the admin menu on the left hand side: "Basic Settings" (select arrow) + "Core Settings". Set basic items like "Server name", etc. The items which can be configured here can also be configured in the httpd.conf file by a knowledgeable admin. (restart after editing.)
  6. The final step for the installer is to launch the WebSphere Application Server "First Step" panel. This may be launched manually any time later on by using the command: /opt/WebSphere/AppServer/bin/firststeps.sh
    This "First Step" panel presents one with the options to:
    • Learn about WebSphere Application Server
      Browser link: http://www-4.ibm.com/software/webservers/appserv/infocenter.html
    • Start the WebSphere server.
      May be started using "First Step" panel or use the command: /opt/WebSphere/AppServer/bin/startServer.sh
    • Run WebSphere Samples.
      Browser link: http://localhost/WSsamples/index.html
    • Launch Administrative Console.
      Browser link: http://localhost:9090/admin (I used a null password)
      (Config file: /opt/WebSphere/AppServer/config/server-cfg.xml)
      Note: It only seemed to work with the node name of "localhost" as I was not running a DNS server to resolve the name of my computer.
    • Launch Application Assembly Tool.
      Command: /opt2/WebSphere/AppServer/bin/assembly.sh
    • Stop the WebSphere server.
      May be stopped using panel or use the command: /opt/WebSphere/AppServer/bin/stopServer.sh
  • WebSphere uses the Lutris Technologies Enhydra server.
  • Ports used: 900, 9000, 9080
  • App server uses JVM in JAVA_HOME /opt2/WebSphere/AppServer/java

Web server plug-in verification/information:

Configure/Run Pet store examples:

  • As root, add user:
    adduser wsdemo
    passwd wsdemo1
  • Configure database: (as user db2as)
    Before you run the WebSphere Samples, execute the following script as user db2as to load the DB2 database: /opt/WebSphere/AppServer/bin/DB2createSampleDB.sh db2as You will be prompted for the password for the user db2as.
  • As user db2as, issue command: db2set DB2COMM=tcpip
  • Run Pet store example: http://localhost/estore

Instructions and more examples: http://localhost/WSsamples/index.html

Post install:

  • The user db2inst1 is generated as a user who may access the instance of the same name. Add to the user profile: /home/db2inst1/.bashrc
    if [ -f /home/db2inst1/sqllib/java12/usejdbc2 ]; then
    . /home/db2inst1/sqllib/java12/usejdbc2
    Also for users: db2inst1, db2fenc1, db2as



"DB2: The Complete Reference (Complete Reference Series)"
by Roman B. Melnyk, Paul C. Zikopoulos
ISBN # 0072133449

"DB2 Developer's Guide (4th Edition)"
by Craig S. Mullins
ISBN # 0672318288

"Complete Guide to DB2 Universal Database"
by D. D. Chamberlin
ISBN # 1558604820, Morgan Kaufmann Publishers

"DB2 Universal Database v7.1 for UNIX, Linux, Windows and OS/2 Database Administration Certification Guide (4th Edition)"
by George Baklarz, Bill Wong, Jonathan Cook
ISBN # 0130913669

"DB2 Universal Database v7.1: Application Development Certification Guide"
by Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou
ISBN # 0130913677

"IBM(R) Websphere(R) Application Server: The Complete Reference"
by Ron Ben-Natan, Ori Sasson
ISBN # 0072223944

"WebSphere Version 4 Application Development Handbook"
by Ueli Wahli, Alex Matthews, Paula Coll Lapido, Jean-Pierre Norguet, Paula Call Lapido
ISBN # 0130092258

"Enterprise Java Programming with IBM WebSphere"
by Kyle Brown (Editor), Gary Craig, Greg Hester, Jaime Niswonger, David Pitt, Russell Stinehour
ISBN # 0201616173

Bookmark and Share



Copyright © 2002 by Greg Ippolito