Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation

Aug. 3, 2021, noon

IBM makes its proprietary enterprise class SQL based RDBMS software, DB2, with all features enabled, freely available to anyone for any purpose except for providing commercial IT services to third parties. The only limitation is the amount of processor and memory resources that Db2 can use for the free download, and contact information is required before being presented with a download link. Users have the option of applying a purchased license to the installation after a three month trial period to remove the limitation.

This article, the first of four articles on getting started with DB2 for readers familiar with the open source RDBMSes MySQL and PostgreSQL, or other interested readers, introduces the available installation methods and preparation for installation of Db2 Database on a Linux system.

Introduction

The series of articles, of which this one is the first, discusses the installation of Db2 Database on a Linux system and describes some of its fundamental concepts. Db2 Database is part of a family of enterprise data management and analysis software, known as Db2. Db2 Database, as an RDBMS (Relational Database Management System) is a core component of the Db2 software collection.

IBM holds a special place in the history of RDBMSes because the foundation of these systems is based on an idea developed in the 1970s by IBM based on a novel method of organizing data called a relational data model presented in a paper by IBM researcher E.F. Codd. The paper also proposed a purpose built declarative language for RDBMSes which was developed at IBM and evolved to SQL.

The edition of Db2 Database installed is the "Community Edition" a perpetually free edition with all features available to the platform enabled, with the only difference from paid versions being a lower limit on resource usage, as indicated in the following listing showing the output of the Db2 Database license checking tool.

db2user@u1804-lab:~$ su - db2inst1
Password:
$ . sqllib/db2profile
$ db2licm -l
Product name:                     "DB2 Community Edition"
License type:                     "Community"
Expiry date:                      "Permanent"
Product identifier:               "db2dec"
Version information:              "11.5"
Max amount of memory (GB):        "16"
Max number of cores:              "4"



$

The Linux system that is the installation target is an Ubuntu 18.04 LTS VirtualBox virtual machine running on a Linux host. The VM is configured with NAT and host-only networking, but is equivalent to an actual remote server for the purposes of these articles. An SSH server has been configured on it, and can be accessed as if it were a remote server by SSH.

The SSH configuration also allows the convenience of transferring files between the local computer and the remote computer -- the installation target -- (in this case the VM) using the fish protocol in Dolphin, the file browser of the Plasma desktop environment which is used on the local computer.

Installation Methods

On Linux and UNIX systems four installation methods are available, described below. Root and non-root installations are also possible. Non-root installations install all database components into a predefined directory within a specific non-root user's home directory, while a root installation is written to directories that are owned by root, such as directories under /opt the standard location for optional software installations from non-distribution sources. This article series only discusses aspects of root installations.

DB2 Setup Installation Wizard

This installation method, employing a Java based GUI, is the simplest method for installing Db2. It provides the option of creating one database instance along with the installation, as well as creating the necessary users and groups to administer the instance. This method does, however, require the X Window System client and/or the X Window System server software to be available on the machine to which Db2 is installed. The way the X Window System is used depends on whether the machine to which Db2 is installed has a complete desktop environment, such as a laptop or a VM with a desktop environment installed, or if it is a remote system that is accessed through a terminal with SSH. In the first case nothing needs to be done for the installation wizard's graphical display to be rendered on the computer because the desktop environment installation has already configured X as necessary.

In the second use case, where the machine to which Db2 is to be installed, is a remote computer (or VM) without a desktop environment, at least the X Window System client software needs to be installed. The GUI display of the installation wizard can then be exported to any other computer, such as the local laptop, which has a running X Window System server. After installing X on the remote machine:

  1. on the remote machine, the DISPLAY environment variable has to be set appropriately to the local computer as in DISPLAY=ip-of-local-computer:1
  2. on the local machine, the X Window Server has to be configured to accept remote connections
This is not secure use of X and probably one of the reasons that is motivating Wayland development, but some mitigation can be implemented as discussed in Getting Started with IBM DB2 on Linux Part II: Installation With DB2 Setup Wizard.

Extracting Payload Files

This method is simplest in terms of what actually happens during installation, but not in terms of ease of use. It requires extracting a set of needed compressed tar.gz archives -- each one comprising a component of the Db2 software -- from the larger installation image compressed tar.gz archive. If users do not want to manually issue a tar extract command for each Db2 component, a shell script can be prepared. Also, after the installation, tasks such as creating an instance, and creating the users and groups for an instance will need to be performed manually after this installation method, tasks the Db2 Setup wizard performs. The payload extraction process and the tasks related to instance creation are described in Getting Started with IBM DB2 on Linux Part III: Manual Installation

db2_install

db2_install is a script distributed in the installation image, that essentially performs the payload extraction, above. However, while the manual payload extraction method allows users to choose which components to install, this tool installs all components. This installation method is discussed in Getting Started with IBM DB2 on Linux Part III: Manual Installation

Silent Command Line Installation with Response File

This method is the most robust, configurable, and efficient installation method available. It is also the simplest in that it performs the tasks of creating as many instances as desired (depending on features installed) as well as the necessary user creation for each instance, and all other detailed Db2 configuration of the software. This method makes use of a response file containing all installation configuration settings which is passed to the same executable that starts the wizard as an option value. Various methods are available for generating the response file, with the one resulting in the most fully configured being a generation from an extensively commented sample response file. This installation method is also discussed in Getting Started with IBM DB2 on Linux Part III: Manual Installation

Prerequisites

Installation of Db2 Database on an Ubuntu Linux system requires the packages listed below to be installed as an installation prerequisite. Installation on other Linux distributions will require packages that provide the capabilities of the listed Ubuntu packages.

  • libaio1
  • binutils
  • liblogger-syslog-perl
  • zlib1g-dev
  • libpam0g:i386
  • libstdc++6
  • libstdc++6:i386
  • ksh, Korn shell (or a wrapper for Korn shell)

Of the above packages, all were already installed on this instance of Ubuntu 18.04 as a result of the initial installation or previous package management actions, except libaio1, liblogger-syslog-perl, zlib1g-dev, libpam0g:i386, libstdc++6:i386, and ksh. Some confusion may result from the fact that libpam0g and libstdc++6 are already installed, but these are 64 bit versions of the libraries while the prerequisites require the 32 bit version of libpam0g and both the 32-bit and 64-bit version of libstdc++6.

libaio1, liblogger-syslog-perl, and zlib1g-dev can be installed with:

$ sudo apt install libaio1 liblogger-syslog-perl zlib1g-dev ksh

Users may realize after running the prerequisite checking tool (see below), that the libpam0g and libstdc++6 do not satisfy the prerequisites because they do not provide the required 32-bit version of these libraries. To get the 32-bit versions, enable the i386 architecture with dpkg as in:

$ sudo dpkg --add-architecture i386

and then install libstdc++6:i386 and libpam0g:i386 with:

$ sudo apt install libstdc++6:i386 libpam0g:i386

Downloading Installation Image

The installation image can be downloaded by clicking the "Download free edition" link at the bottom of the "Community Edition" column of the edition comparison table on the Db2 Database Pricing page. This leads to a form where contact information is requested, after the submission of which, the actual download links for various Db2 Database products are displayed. The relevant pages are shown in the following set of images.

IBM Db2 Download Center
The download center opens after providing contact information. The Db2 Download Center provides links for downloading Db2 Database installation images for various platforms as well as associated tools for administration and database application development.

Clicking the "Download" link corresponding to the "Linux(x64)" platform will allow the installation image to be saved on the local computer. If the installation target is a remote computer, it should be transferred to it.

Preparing for Installation

The download installation image saved to the VM host (or local) machine, must first be transferred to the VM guest (or remote) target computer. It should be transferred to a staging directory on the target machine. For the purposes of this article, this is a directory inside the home directory of a user created for working with Db2. For Plasma users this transfer can be performed using the fish protocol in Dolphin, the Plasma desktop environment's file browser.Then the image is extracted. As a final step before installation, a tool distributed with the image can be used to verify that the prerequisites are met using. These steps are detailed below.

  1. Make a directory for the installer image on the target machine.
    db2user@u1804-lab:~$ mkdir /home/db2user/software
    db2user is a user created on the target specifically to perform the Db2 installation and use when managing Db2.
  2. Make the directory accessible to all classes of users as suggested in the documentation.
    db2user@u1804-lab:~$ sudo chmod 777 /home/db2user/software
  3. Copy the downloaded file to /home/db2user/software
  4. Switch user to root.
    db2user@u1804-lab:~$ su - root
  5. Change to /home/db2user/software
    root@u1804-lab:~# cd /home/db2user/software
  6. Extract the installation image.
    root@u1804-lab:/home/db2user/software # tar -xvf v11.5_linux64xx64_dec.tar.gz
  7. Delete the tar file created as a result of the previous command.
    root@u1804-lab:/home/db2user/software # rm -f v*.tar
  8. Make the directory created as a result of the tar extraction, server_dec accessible to all classes fo users, as suggested in the documentation.
    root@u1804-lab:/home/db2user/software # chmod 777 server_dec
  9. Rename server_dec to ibm_db2
    root@u1804-lab:/home/db2user/software # mv server_dec ibm-db2
  10. Change directory to ibm_db2.
    root@u1804-lab:/home/db2user/software # cd ibm-db2
  11. Finally, perform the prerequisite verification using a tool distributed with the installation image.
    root@u1804-lab:/home/db2user/software/ibm-db2 # ./db2prereqcheck -v 11.5.5.0

The following listing shows a failure of the prerequisite verification. The check failed because the necessary 32-bit packages were not available.

root@u1804-lab:/home/db2user/software/ibm-db2# ./db2prereqcheck -v 11.5.5.0

==========================================================================

Tue Dec 29 01:18:54 2020
Checking prerequisites for DB2 installation. Version "11.5.5.0". Operating system "Linux" 
   
Validating "Linux distribution " ... 
   Required minimum "UBUNTU" version: "16.04" 
   Actual version: "18.04" 
   Requirement matched. 
   
Validating "kernel level " ... 
   Required minimum operating system kernel level: "3.10.0". 
   Actual operating system kernel level: "4.15.0". 
   Requirement matched. 
   
Validating "C++ Library version " ... 
   Required minimum C++ library: "libstdc++.so.6" 
   Standard C++ library is located in the following directory: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25". 
   Actual C++ library: "CXXABI_1.3.1" 
   Requirement matched. 
   

Validating "32 bit version of "libstdc++.so.6" " ... 
   Found the 64 bit "/usr/lib/x86_64-linux-gnu/libstdc++.so.6" in the following directory "/usr/lib/x86_64-linux-gnu". 
DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6". 
   
Validating "libaio.so version " ... 
DBT3553I  The db2prereqcheck utility successfully loaded the libaio.so.1 file. 
   Requirement matched. 
   
Validating "libnuma.so version " ... 
DBT3610I  The db2prereqcheck utility successfully loaded the libnuma.so.1 file. 
   Requirement matched. 
   
Validating "/lib/i386-linux-gnu/libpam.so*" ... 
   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/i386-linux-gnu/libpam.so*". 
   WARNING : Requirement not matched. 
Requirement not matched for DB2 database "Server" . Version: "11.5.5.0". 
Summary of prerequisites that are not met on the current system: 
   DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/i386-linux-gnu/libpam.so*". 


DBT3514W  The db2prereqcheck utility failed to find the following 32-bit library file: "libstdc++.so.6".

Adding the i386 architecture to the system package manager, installing libpam0g:i386 and libpam0g:i386, as described above, will correct the above failures and cause subsequent verification of the prerequisites to pass, as shown below:

root@u1804-lab:/home/db2user/software/ibm-db2# ./db2prereqcheck -v 11.5.5.0

==========================================================================

Tue Dec 29 02:03:43 2020
Checking prerequisites for DB2 installation. Version "11.5.5.0". Operating system "Linux" 
   
Validating "Linux distribution " ... 
   Required minimum "UBUNTU" version: "16.04" 
   Actual version: "18.04" 
   Requirement matched. 
   
Validating "kernel level " ... 
   Required minimum operating system kernel level: "3.10.0". 
   Actual operating system kernel level: "4.15.0". 
   Requirement matched. 
   
Validating "C++ Library version " ... 
   Required minimum C++ library: "libstdc++.so.6" 
   Standard C++ library is located in the following directory: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25". 
   Actual C++ library: "CXXABI_1.3.1" 
   Requirement matched. 
   

Validating "32 bit version of "libstdc++.so.6" " ... 
   Found the 32 bit "/usr/lib/i386-linux-gnu/libstdc++.so.6" in the following directory "/usr/lib/i386-linux-gnu". 
   Requirement matched. 
   
Validating "libaio.so version " ... 
DBT3553I  The db2prereqcheck utility successfully loaded the libaio.so.1 file. 
   Requirement matched. 
   
Validating "libnuma.so version " ... 
DBT3610I  The db2prereqcheck utility successfully loaded the libnuma.so.1 file. 
   Requirement matched. 
   
Validating "/lib/i386-linux-gnu/libpam.so*" ... 
   Requirement matched. 
DBT3533I  The db2prereqcheck utility has confirmed that all installation prerequisites were met.

Next Steps

The installation preparation is simple and straightforward for the most part. The only complication may be for those who may not have had the need for 32-bit libraries in recent versions of Ubuntu which do not have them enabled by default.

The next part of this series, , describes the use of the Db2 Setup wizard distributed with the installation image to install Db2 Database.

References

blog comments powered by Disqus