Skip to main content

skip to main content

developerWorks  >  Linux | Open source  >

Speed-start your Linux app 2004: Installing DB2 Version 8.1.6 for Linux

How to install and configure DB2 Personal Edition Version 8.1.6 for Linux and the Java Runtime Environment

developerWorks
Document options

Document options requiring JavaScript are not displayed


My developerWorks needs you!

Connect to your technical community


Rate this page

Help us improve this content


Level: Introductory

Ian Shields (ishields@us.ibm.com), Senior programmer, IBM

13 Aug 2004

This article guides you through the steps to install IBM DB2® Universal Database Personal Edition V8.1.6, as well as the IBM Java™ Runtime Environment (JRE), with minimal fuss and frustration. Developers who are new to Linux or UNIX-based operating systems will get the most out of this article. Share your questions and comments on this article with the author and other readers in the discussion forum for this article.

This article shows you how to:

  • Check your Linux for required space and prerequisite packages, such as pdksh
  • Install the IBM JDK with the rpm command
  • Install DB2 with the db2setup command
  • Add a tools catalog to an existing DB2 installation
  • Install the DB2 developer tools
  • Take your first steps with DB2

Before you begin

Order the Linux SEKThis article supplements the basic installation instructions on the Software Evaluation Kit (SEK) Linux Platform -- 2H 2004 DVD (order the SEK). This article guides you through installing DB2 Personal Edition Version 8.1.6 for Linux on Red Hat Enterprise Linux v3 (RHEL3) or SUSE Linux Enterprise Server 8 (SLES8).

Notes:

  • If your distribution uses a 2.4 kernel but is not listed as being supported at DB2 for Linux, this version of DB2 may or may not work for you. Red Hat 9 is not a supported distribution for DB2.
  • This version was not designed for use on 2.6 kernels. If you are using a system with a 2.6 kernel, please try the DB2 UDB "Stinger" open beta instead.

RHEL3. If you are installing on Red Hat Enterprise Linux v3 (RHEL3), or using a 2.4 kernel with the New POSIX Thread Library (NPTL), pay particular attention to the sections marked RHEL3 in this article.

SLES8. If you are installing on SUSE Linux Enterprise Server 8 (SLES8), or using a 2.4 kernel without NPTL, pay particular attention to the sections marked SLES8 in this article.

For information on other supported Linux distributions, see DB2 for Linux. If you are installing on another distribution, please check the online documentation for that distribution.

If you're new to Linux and need help with logging in as root, mounting a CD, or opening a terminal window, see the Basic tasks for new Linux developers, which covers these tasks and more.



Back to top


Prerequisites

The instructions in this article assume you are using RHEL3 with Update 1, or SLES8. (Unless otherwise noted, the examples in this article apply to a RHEL3 system with Update 1.) Log in as root and open a terminal window. Then use the uname command with the -rv option to check that you have a suitable 2.4 kernel level, and use the getconf command or the rpm command to check whether you have NPTL or not.


Listing 1. Checking kernel and glibc versions

			 

RHEL3

[root@lyrebird root]# uname -rv

2.4.21-15.0.3.EL #1 Tue Jun 29 18:17:52 EDT 2004

[root@lyrebird root]# getconf GNU_LIBPTHREAD_VERSION

NPTL 0.60

[root@lyrebird root]# rpm -q glibc

glibc-2.3.2-95.20

SLES8.

lyrebird:~ # uname -rv

2.4.21-231-default #1 Mon Jun 28 15:39:14 UTC 2004

lyrebird:~ # getconf GNU_LIBPTHREAD_VERSION

getconf: Unrecognized variable `GNU_LIBPTHREAD_VERSION'

lyrebird:~ # rpm -q glibc

glibc-2.2.5-213

Note that NPTL was part of the glibc 2.3.2 package. Systems without NPTL respond with an error to the getconf query for LIBPTHREAD_VERSION. Systems with NPTL respond either with the NPTL version or with an indication that linuxthreads compatibility mode has been activated for the terminal session.

Next, use the which command to check whether ksh (the Korn shell) is installed. If you know the package name, you can use the rpm command instead.


Listing 2. Checking for the Korn shell

			 

[root@lyrebird root]# which ksh

/bin/ksh

[root@lyrebird root]# rpm -q pdksh

pdksh-5.2.14-21

If you do not have the pdksh package installed, please see Installing prerequisite Linux packages before you install the IBM DB2 software.

For a typical installation, you need at least 500 MB of free space in the /opt file system and at least 50 MB of space in the /home file system. In addition, you need space for your databases. Disk sizes are usually measured in megabytes using powers of 1,000 (rather than 1,024 as used for many other computer measurements). All sizes here refer to powers of 1,000, so a megabyte is 1,000,000 bytes, not 1,048,576 bytes.

Use the df command to check your disk space. If you are downloading to the same location, make sure that you have at least 1030 MB free. To get a report in human readable form using multiples of 1,000 (rather than number of disk blocks using multiples of 1024), add the -H option.


Listing 3. Checking for sufficient free space

			 

[root@lyrebird root]# df -H /opt

Filesystem             Size   Used  Avail Use% Mounted on

/dev/hda10             17GB  5.1GB   11GB  32% /

[root@lyrebird root]# df -H /home

Filesystem             Size   Used  Avail Use% Mounted on

/dev/hda10             17GB  5.1GB   11GB  32% /

In this example, both the /opt and /home filesystems are on the same device, /dev/hda10, which is a logical partition on my first IDE hard drive.



Back to top


Installing the JRE

DB2 V8.1.6 requires an IBM Java Runtime Environment. If the installation wizard does not find one, it will install the 1.3.1 version in /opt/IBMJava2-131 for you.

SLES8 If your system does not use NPTL, it is not necessary to separately install Java.

RHEL3 The version of the IBM JRE that is shipped with DB2 is not supported on systems with NPTL, such as RHEL3. You may use a silent (non-GUI) install and then use only command-line tools, or you may install another IBM development kit as a workaround. This workaround is unsupported, but it will generally allow you to use the GUI installer and GUI DB2 tools.

To install the IBMJava2-SDK-1.4.1-2.0.i386.rpm, open a terminal window, mount the 2H 2004 SEK DVD, and change your current directory to the DVD root (for example /mnt/cdrom). Then change to the jdk141 directory on the DVD and run the rpm command.


Listing 4. Installing the IBM 1.4.1 JDK

			 

[root@lyrebird root]# cd /mnt/cdrom

[root@lyrebird cdrom]# cd jdk141



[root@lyrebird jdk141]# rpm -Uvh *.rpm

Preparing...                ########################################### [100%]

   1:IBMJava2-SDK           ########################################### [100%]



Back to top


Installing DB2 for Linux

Log in as root and open a terminal window, or su to root. You will need a graphical environment, so if you use the su command to switch to the root user, make sure your display is set up properly. If you are new to Linux, please refer to the Basic tasks for new Linux developers for tasks such as switching to another userid and setting up your display, mounting a CD-ROM, and opening a terminal window.

  1. RHEL3 To use the DB2 GUI installer with the IBM JDK 1.4.1 that you installed above, you must set several environment variables before you proceed.


    Listing 5. Exporting environment variables

    
    			 
    
    export DB2USELOCALJRE=TRUE
    
    export JAVA_HOME=/opt/IBMJava2-141
    
    export LD_ASSUME_KERNEL=2.4.19
    
    export RPM_FORCE_NPTL=1

    If these are not set, the installer may either abend or hang and use of the rpm command may corrupt your RPM database.

    Hint: If you have a three-button mouse (or if you have set up your mouse to emulate three buttons by chording both buttons -- that is, holding down both together), you can hold down your left button and drag over text in one window and then use the middle button (or chord both buttons on a 2-button mouse) to paste the highlighted text into the rest of the command. You can use this handy trick within a window or between windows.

  2. Mount the 2H 2004 SEK DVD and change your current directory to the DVD root. Then change to the db2pe816/pe directory on the DVD. Note that the root of your DVD drive may be different from the examples shown in Listing 6.


    Listing 6. Accessing the DB2 installation files

    
    			 
    
    SLES8
    
    lyrebird:~ # cd /media/cdrom1
    
    lyrebird:/media/cdrom1 # cd db2pe816/pe
    
    lyrebird:/media/cdrom1/db2pe816/pe #
    
    RHEL3
    
    [root@lyrebird root]# cd /mnt/cdrom
    
    [root@lyrebird cdrom]# cd db2pe816/pe
    
    [root@lyrebird pe]#
    
    

  3. Start the DB2 setup by entering ./db2setup. For security reasons, you should not have root automatically running programs from the current directory, so you need the leading ./. You should see a screen like this:
    Figure 1. Starting db2setup
    Starting db2setup

    You may browse the installation notes or take a quick tour if you wish. When you are ready, click Install products to start the installation.

  4. Start by selecting the DB2 Personal Edition. Click Next.
    Figure 2. Choosing DB2 Personal Edition installation
    Choosing DB2 Personal Edition installation
  5. You will see a splash screen and notice a delay as the installation wizard introductory screen loads. Click Next. Review and accept the license. Click Next again. Select the installation type; choose Typical. You may add Data warehousing if you wish. You may click View features to view the features that will be installed, but if you need to change them, you should do a Custom installation rather than a typical installation. When you are ready, click Next.
    Figure 3. Select the installation type
    Select the installation type
  6. Click Next on the installation action screen and move on to the DAS user screen. (This may appear different than in previous DB2 installations.) Make sure you use a secure password. After you successfully enter a password, click Next.
    Figure 4. Setting up the DB2 Administrative server userid
    Setting up the DB2 Administrative server userid
  7. Now accept (or select, if necessary) the option to create a DB2 instance and click Next.
    Figure 5. Creating a DB2 instance
    Creating a DB2 instance
  8. This will take you to the instance owner setup screen for the instance. The default instance name is db2inst1, and a system user of the same name will be created. Databases for this instance are created in the home directory of this user unless you specify another location when you are creating the database. Again, make sure you use a secure password and enter it twice. After you successfully enter a password, click Next.
    Figure 6. Setting up the DB2 Instance owner userid
    Setting up the DB2 Instance owner userid
  9. In the same way, specify a password for the DB2 Fenced User id. User-defined functions will run under the id of the fenced user and, for security reasons, this id should not be the same as that of the instance owner. Again, after you successfully enter a password, click Next.

  10. If this is your first DB2 database, you will want a tools catalog.

    SLES8 If you want to create the tools catalog now, select the option to "Use a local database".

    RHEL3 If you attempt to create a tools catalog as part of your initial DB2 system installation, the installation process may hang. These steps show you how to create the tools catalog later. Do not do it now if you have an NPTL system.

    Click Next.
    Figure 7. Creating a DB2 tools catalog
    Creating a DB2 tools catalog

    If you are creating a tools catalog now, on the next screen accept the defaults to have it created in your new instance and click Next again.

  11. Now you may specify a userid for notification. If you do not currently have an SMTP server running, you may still set up the contact list, but disable the checkbox marked Enable notification.
    Figure 8. Specifying a contact list
    Specifying a contact list
  12. You can accept or change the defaults for an id to receive health notifications in the event of database health thresholds being reached. After you finish with the health monitor selection, click Next.
    Figure 9. Start copying files
    Start copying files
  13. You should now see a summary of your choices. Review these and click Finish to start copying files and setting up your system.
    Figure 10. Start copying files
    Start copying files
  14. When the installation is complete, you should see a post install summary, showing what steps remain to be done and the status of the installation.
    Figure 11. Post install summary
    Post install summary

    Note: The documentation CD that is mentioned in the summary is not shipped as part of the 2H 2004 SEK. See Resources for online DB2 documentation.

  15. RHEL3 If you are using a version of Java other than the one that comes with DB2, you need to reconfigure DB2 at this point. Use the su command to switch to user db2inst1, and then stop the DB2 admin server and DB2 instance, using the command. Finally, update the dbm config and the admin config to the location of your Java. Listing 7 shows the update commands split across two lines to allow the listing to fit on a screen, but you can enter them on a single line:
    db2 update dbm cfg using JDK_PATH /opt/IBMJava2-141
    db2 update admin cfg using JDK_PATH /opt/IBMJava2-141


    Listing 7. Updating the DB2 Java configuration

    
    			 
    
    [root@lyrebird root]# su - db2inst1
    
    [db2inst1@lyrebird db2inst1]$ ~dasusr1/das/bin/db2admin stop
    
    SQL4407W  The DB2 Administration Server was stopped successfully.
    
    [db2inst1@lyrebird db2inst1]$ db2stop
    
    SQL1064N  DB2STOP processing was successful.
    
    [db2inst1@lyrebird db2inst1]$ db2 update dbm cfg using \
    
    > JDK_PATH /opt/IBMJava2-141
    
    DB20000I  The UPDATE DATABASE MANAGER CONFIGURATION command completed
    
    successfully.
    
    [db2inst1@lyrebird db2inst1]$ db2 update admin cfg using \
    
    > JDK_PATH /opt/IBMJava2-141
    
    DB20000I  The UPDATE ADMIN CONFIGURATION command completed successfully.
    
    

You have now installed DB2 and its Administration Server and created an instance of DB2. If you need to add features later, you can always rerun db2setup. The next section shows you how to add the administrative tools catalog.



Back to top


Adding a tools catalog

To add a tools catalog to your new DB2 installation:

  1. Stop the DB2 administrative server and DB2 instance using the commands shown in Listing 8. Typical output is shown in the last step of the previous section.


    Listing 8. Stopping the DB2 admin server and instance

    
    			 
    
    su - db2inst1
    
    ~dasusr1/das/bin/db2admin stop
    
    db2stop
    
    

    Return your terminal window to root usage by pressing Ctrl-d.

  2. If you are in the window where you ran ./db2setup, you may now run it again. Otherwise, repeat the first few steps of the previous section to restart DB2 setup.

    RHEL3 Remember to export the environment variables as shown in the previous section if you are not using the same window that you used for the install.

  3. From the DB2 setup menu, select "Install Products" again and proceed to the Welcome screen again. You now have an option to install additional features or work with DB2 instances. Click to remove the check mark from the option "Create a new DB2 instance or set up an existing DB2 instance" and then click Next.
    Figure 12. Install additional DB2 features
     Install additional DB2 features
  4. This time, click to select the option "Use a local database" on the DB2 tools catalog preparation screen. Click Next.
    Figure 13. Prepare the DB2 tools catalog
    Prepare the DB2 tools catalog
  5. On the next screen, select the instance (db2inst1) that you created during your initial install from the drop-down list. Click Next to review the summary of your choices and then click Finish to install the tools catalog. You will see a progress dialog and then a post-install summary similar to those you saw for the original install.
    Figure 14. Select the DB2 instance for the tools catalog
    Select the DB2 instance for the tools catalog
  6. If you want to add developer tools to your DB2 installation, proceed to the next section, Otherwise, you may now restart your admin server and instance before proceeding to the DB2 First Steps section. Use the following commands to restart the admin server and DB2 instance.


    Listing 8. Restarting the DB2 admin server and instance

    
    			 
    
    su - db2inst1
    
    ~dasusr1/das/bin/db2admin start
    
    db2start
    
    

Congratulations! You have now installed your tools catalog.



Back to top


Adding developer tools

The DB2 Application Development Client is a collection of tools for developing DB2 applications. To add these developer tools to your new DB2 installation:

  1. Stop your administrative server and DB2 instance as you did in Step 1 of the previous section.

  2. Restart db2setup as you did in Step 2 of the previous section and proceed as far as the Setup screen. On the Setup screen, click the radio button to select "DB2 Application Development Client".
    Figure 15. Select the DB2 instance for the tools catalog
    Select the DB2 instance for the tools catalog
  3. Continue through the welcome screen and the license acceptance screen. On the screen to choose installation tupe, accept the default of "Typical", and click Next. On the next screen, click the radio button to "Configure new function for an existing DB2 instance", and select "db2inst1" from the dropdown list.
    Figure 16. Select the DB2 instance for the tools catalog
    Select the DB2 instance for the tools catalog
  4. Click Next to review the summary of your choices and then click Finish to install the development client. You will see a progress dialog and then a post-install summary similar to those you saw in the previous steps.

  5. Restart your admin server and instance before continuing to the DB2 First Steps section. Use the following commands to restart the admin server and DB2 instance.


    Listing 9. Restarting the DB2 admin server and instance

    
    			 
    
    su - db2inst1
    
    ~dasusr1/das/bin/db2admin start
    
    db2start
    
    

Congratulations! You have now installed your development client.



Back to top


DB2 First Steps

To start exploring DB2, you should now log off as root and log back in as user db2inst1.

  1. You will notice that your graphical desktop contains a DB2 folder. When you open this folder, you see a number of icons as shown in Figure 15 with a portion of a Gnome desktop from a RHEL3 system.
    Figure 17. The db2inst1 desktop and DB2 folder
    The db2inst1 desktop and DB2 folder
  2. Double-click on the "First Steps" icon to launch the DB2 First Steps program, which will help you get acquainted with DB2.
    Figure 18. DB2 First Steps
    DB2 First Steps

Congratulations! You've now installed and configured DB2. Use the resources below to further explore DB2.



Resources



About the author

Ian Shields

Ian Shields is currently researching Linux technology for the developerWorks Linux zone, and is a Senior Programmer at IBM at the Research Triangle Park, NC. He joined IBM in Canberra, Australia, as a systems engineer in 1973, and has since worked on communications systems and pervasive computing in Montreal, Canada, and RTP, NC. He has several patents. His undergraduate degree is in pure mathematics and philosophy from the Australian National University. He has an M.S. and Ph.D. in computer science from North Carolina State University. You can contact Ian at ishields@us.ibm.com.




Rate this page


Please take a moment to complete this form to help us better serve you.



 


 


Not
useful
Extremely
useful
 


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!



Back to top