How to install IBM Db2 Database v11.5 on Ubuntu 16.4.

How to install IBM Db2 Database v11.5 on Ubuntu 16.4.

This is the first blog post of a series to try to install as many databases SQL and NoSQL (#useThemAll) as possible on VMs at home (Lab @ Home) in order to learn more about them.

So let's start installing IBM Db2 on Ubuntu using Virtual Box

So we go to the IBM Db2 Database portal here and log in or if needed create a free IBM account to download the installation files.

I'll follow recommendations from the IBM Db2 Version 11.5 Knowledge Center

Photo by Carson Masterson / Unsplash
I've downloaded this file v11.5_linuxx64_dec.tar.gz (1.43GB)

Disk and memory requirements

Disk requirements

The /tmp space that is required for a Db2 environment is 512 MB.

The /var directory requires 512 MB of free space.

The default instance home directory is /home and the default installation directory is /opt/IBM/db2/<version>. Approximately 1 to 1.5 GB of free space in the /home directory is normally required.

Memory requirements

At a minimum, a Db2 database instance requires 512MB of RAM, plus an additional 512MB of RAM per database. However, 1 GB or greater of RAM per instance and per database is recommended for improved performance.

Paging space requirements

A reasonable minimum swap/paging space configuration for most systems is 25-50% of RAM.

Additional installation considerations (Linux)

Package requirements

Package requirements for SLES and RHEL distributions:

  • libpam.so.0 (32-bit) is required for Db2 database servers to run 32-bit non-SQL routines and JDBC type 2 driver applications in 32-bit JDK.
  • libpam.so.0 is required by IBM data server clients for Db2 user authentication.
  • libaio.so.1 is required for Db2 database servers that use asynchronous I/O.
  • libstdc++.so.6is required for Db2 database servers and clients.
  • libstdc++33and libstdc++43 are required for SLES 11.
  • The ksh93 Korn shell is required for all Db2 database systems.

On the Ubuntu 16.4 VM.

In the terminal, let's try the following commands.

To Update and install newer versions of the packages.

sudo apt update && sudo apt upgrade -y

To uncompress and untar the installation file.

# I've uploaded the installation file to /home/ubuntu/db2Installer
ubuntu@ubusrvdb2: /home/ubuntu/db2Installer>
$ ls -lrt
total 1877688
-rw-rw-r-- 1 ubuntu ubuntu 1922745800 Feb 14 12:45 v11.5_linuxx64_dec.tar.gz

# Uncompress file .gz using gunzip
ubuntu@ubusrvdb2: /home/ubuntu/db2Installer>
$ gunzip v11.5_linuxx64_dec.tar.gz

# Extract files from .tar
ubuntu@ubusrvdb2: /home/ubuntu/db2Installer>
$ tar -xvf v11.5_linuxx64_dec.tar
.
.
.
server_dec/db2/spec
server_dec/db2/.client
server_dec/db2/.consv
server_dec/db2/.ese
ubuntu@ubusrvdb2: /home/ubuntu/db2Installer>
$

Let's see what the installation files look like.

ubuntu@ubusrvdb2: /home/ubuntu/db2Installer/server_dec>
$ ls -lrt
total 116
-r-xr-xr-x 1 ubuntu ubuntu  5592 Jun 11  2019 db2prereqcheck
-r-xr-xr-x 1 ubuntu ubuntu  5600 Jun 11  2019 db2setup
-r--r--r-- 1 ubuntu ubuntu 47555 Jun 11  2019 db2checkCOL.tar.gz
-r-xr-xr-x 1 ubuntu ubuntu  5582 Jun 11  2019 db2ls
-r-xr-xr-x 1 ubuntu ubuntu  5748 Jun 11  2019 db2_deinstall
-r--r--r-- 1 ubuntu ubuntu  4987 Jun 11  2019 db2checkCOL_readme.txt
-r-xr-xr-x 1 ubuntu ubuntu  5833 Jun 11  2019 db2ckupgrade
-r-xr-xr-x 1 ubuntu ubuntu  5618 Jun 11  2019 db2_install
-r-xr-xr-x 1 ubuntu ubuntu  5636 Jun 11  2019 instal

and if we meet the requirements.

Checking installation prerequisites by using the db2prereqcheck command

ubuntu@ubuntu: /home/ubuntu/db2Installer/server_dec>
$ ./db2prereqcheck -v 11.5.0.0
==========================================================================

Mon Feb 17 09:17:43 2020
Checking prerequisites for DB2 installation. 
Version "11.5.0.0". Operating system "Linux"

Validating "Linux distribution " ...
   Required minimum "UBUNTU" version: "16.04"
   Actual version: "16.04"
   Requirement matched.

Validating "kernel level " ...
   Required minimum operating system kernel level: "3.10.0".
   Actual operating system kernel level: "4.4.0".
   Requirement matched.
ERROR:
   The 'strings' utility that is used to detect prerequisite libraries
   is not present on this system.  Please use your package or software
   manager to install the GNU Binary Utilities.

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.21".
DBT3512W  The db2prereqcheck utility failed to determine the currently-installed version of the C++ standard library, libstdc++.
   Requirement matched.

Validating "libaio.so version " ...
DBT3552E  The db2prereqcheck utility failed to open the libaio.so.1 file. Command output: "libaio.so.1: cannot open shared object file: 
No such file or directory".
DBT3520E  The db2prereqcheck utility could not find the library file libaio.so.1.
   ERROR : Requirement not 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.0.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*".


DBT3520E  The db2prereqcheck utility could not find the library file libaio.so.1.

Unfortunately, no, but can fix this installing the following libraries and creating a symbolic link as shown bellow:

# Installing lib32stdc++6 32 bits
$ sudo apt-get install lib32stdc++6

# Installing libaio
sudo apt-get install libaio-dev

# Installing libpam0g:i386
$ sudo apt-get install libpam0g:i386

# Installing libstdc++5 libstdc++6
$ sudo apt-get install libstdc++5 libstdc++6

# Installing gcc-4.9
$ sudo apt-get install gcc-4.9

$ sudo find / -name "libpam.so*"
/lib/i386-linux-gnu/libpam.so.0.83.0
/lib/i386-linux-gnu/libpam.so.0
/lib/x86_64-linux-gnu/libpam.so.0.83.0
/lib/x86_64-linux-gnu/libpam.so.0

# Symbolic link
$ sudo ln -s /lib/i386-linux-gnu/libpam.so.0 /lib/libpam.so

We try again the db2prereqcheck command.

ubuntu@ubusrvdb2: /home/ubuntu/db2Installer/server_dec>
$ ./db2prereqcheck -v 11.5.0.0

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

Fri Feb 14 13:15:44 2020
Checking prerequisites for DB2 installation. Version "11.5.0.0". Operating system "Linux"

Validating "Linux distribution " ...
   Required minimum "UBUNTU" version: "16.04"
   Actual version: "16.04"
   Requirement matched.

Validating "kernel level " ...
   Required minimum operating system kernel level: "3.10.0".
   Actual operating system kernel level: "4.4.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.21".
   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".
   Found the 32 bit "/usr/lib32/libstdc++.so.6" in the following directory "/usr/lib32".
   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.

All requirements are matched!

Now that we meet all the requirements, let's try to install Db2 using the db2setup command. (as root).

root@ubuntu:/home/ubuntu/db2Installer/server_dec# ./db2_install
Read the license agreement file in the db2/license directory.

***********************************************************
To accept those terms, enter "yes". Otherwise, enter "no" to cancel the install process. [yes/no]
yes

Default directory for installation of products - /opt/ibm/db2/V11.5

***********************************************************
Install into default directory (/opt/ibm/db2/V11.5) ? [yes/no]
yes


Specify one of the following keywords to install DB2 products.

  SERVER
  CONSV
  CLIENT
  RTCL

Enter "help" to redisplay product names.

Enter "quit" to exit.

***********************************************************
SERVER
***********************************************************
Do you want to install the DB2 pureScale Feature? [yes/no]
no
DB2 installation is being initialized.

 Total number of tasks to be performed: 58
Total estimated time for all tasks to be performed: 2819 second(s)

Task #1 start
Description: Checking license agreement acceptance
Estimated time 1 second(s)
Task #1 end

Task #2 start
Description: Base Client Support for installation with root privileges
Estimated time 3 second(s)
Task #2 end

Task #3 start
Description: Product Messages - English
Estimated time 14 second(s)
Task #3 end

Task #4 start
Description: Base client support
Estimated time 359 second(s)
Task #4 end

Task #5 start
Description: Java Runtime Support
Estimated time 214 second(s)
Task #5 end

Task #6 start
Description: Java Help (HTML) - English
Estimated time 7 second(s)
Task #6 end

Task #7 start
Description: Base server support for installation with root privileges
Estimated time 8 second(s)
Task #7 end

Task #8 start
Description: Global Secure ToolKit
Estimated time 69 second(s)
Task #8 end

Task #9 start
Description: Java support
Estimated time 12 second(s)
Task #9 end

Task #10 start
Description: SQL procedures
Estimated time 3 second(s)
Task #10 end

Task #11 start
Description: ICU Utilities
Estimated time 63 second(s)
Task #11 end

Task #12 start
Description: Java Common files
Estimated time 19 second(s)
Task #12 end

Task #13 start
Description: Base server support
Estimated time 743 second(s)
Task #13 end

Task #14 start
Description: Control Center Help (HTML) - English
Estimated time 13 second(s)
Task #14 end

Task #15 start
Description: Relational wrappers common
Estimated time 3 second(s)
Task #15 end

Task #16 start
Description: DB2 data source support
Estimated time 6 second(s)
Task #16 end

Task #17 start
Description: ODBC data source support
Estimated time 222 second(s)
Task #17 end

Task #18 start
Description: Teradata data source support
Estimated time 4 second(s)
Task #18 end

Task #19 start
Description: Spatial Extender server support
Estimated time 19 second(s)
Task #19 end

Task #20 start
Description: Scientific Data Sources
Estimated time 5 second(s)
Task #20 end

Task #21 start
Description: JDBC data source support
Estimated time 233 second(s)
Task #21 end

Task #22 start
Description: IBM Software Development Kit (SDK) for Java(TM)
Estimated time 49 second(s)
Task #22 end

Task #23 start
Description: DB2 LDAP support
Estimated time 4 second(s)
Task #23 end

Task #24 start
Description: DB2 Instance Setup wizard
Estimated time 25 second(s)
Task #24 end

Task #25 start
Description: Structured file data sources
Estimated time 5 second(s)
Task #25 end

Task #26 start
Description: Integrated Flash Copy Support
Estimated time 3 second(s)
Task #26 end

Task #27 start
Description: Oracle data source support
Estimated time 4 second(s)
Task #27 end

Task #28 start
Description: Connect support
Estimated time 3 second(s)
Task #28 end

Task #29 start
Description: Application data sources
Estimated time 4 second(s)
Task #29 end

Task #30 start
Description: Spatial Extender client
Estimated time 3 second(s)
Task #30 end

Task #31 start
Description: SQL Server data source support
Estimated time 4 second(s)
Task #31 end

Task #32 start
Description: Communication support - TCP/IP
Estimated time 3 second(s)
Task #32 end

Task #33 start
Description: Tivoli SA MP
Estimated time 300 second(s)
Task #33 end

Task #34 start
Description: Base application development tools
Estimated time 33 second(s)
Task #34 end

Task #35 start
Description: DB2 Update Service
Estimated time 4 second(s)
Task #35 end

Task #36 start
Description: Parallel Extension
Estimated time 3 second(s)
Task #36 end

Task #37 start
Description: EnterpriseDB code
Estimated time 4 second(s)
Task #37 end

Task #38 start
Description: Replication tools
Estimated time 61 second(s)
Task #38 end

Task #39 start
Description: Sample database source
Estimated time 4 second(s)
Task #39 end

Task #40 start
Description: itlm
Estimated time 3 second(s)
Task #40 end

Task #41 start
Description: DB2 Text Search
Estimated time 107 second(s)
Task #41 end

Task #42 start
Description: Command Line Processor Plus
Estimated time 7 second(s)
Task #42 end

Task #43 start
Description: Sybase data source support
Estimated time 3 second(s)
Task #43 end

Task #44 start
Description: Informix data source support
Estimated time 6 second(s)
Task #44 end

Task #45 start
Description: Federated Data Access Support
Estimated time 3 second(s)
Task #45 end

Task #46 start
Description: First Steps
Estimated time 3 second(s)
Task #46 end

Task #47 start
Description: Product Signature for DB2 Server Edition
Estimated time 7 second(s)
Task #47 end

Task #48 start
Description: Guardium Installation Manager Client
Estimated time 36 second(s)
Task #48 end

Task #49 start
Description: Setting DB2 library path
Estimated time 180 second(s)
Task #49 end

Task #50 start
Description: Installing or updating DB2 HA scripts for IBM Tivoli System Automation for Multiplatforms (Tivoli SA MP)
Estimated time 40 second(s)
Task #50 end

Task #51 start
Description: Executing control tasks
Estimated time 20 second(s)
Task #51 end

Task #52 start
Description: Updating global registry
Estimated time 20 second(s)
Task #52 end

Task #53 start
Description: Starting DB2 Fault Monitor
Estimated time 10 second(s)
Task #53 end

Task #54 start
Description: Updating the db2ls and db2greg link
Estimated time 1 second(s)
Task #54 end

Task #55 start
Description: Registering DB2 licenses
Estimated time 5 second(s)
Task #55 end

Task #56 start
Description: Setting default global profile registry variables
Estimated time 1 second(s)
Task #56 end

Task #57 start
Description: Initializing instance list
Estimated time 5 second(s)
Task #57 end

Task #58 start
Description: Registering DB2 Update Service
Estimated time 30 second(s)
Task #58 end

Task #59 start
Description: Updating global profile registry
Estimated time 3 second(s)
Task #59 end

The execution completed with warnings.

For more information see the DB2 installation log at
"/tmp/db2_install.log.13434".
more /tmp/db2_install.log.13434 ==> It is recommended to review the installation logs.

db2ls - Lists the Db2 products and features installed on Linux.

root@ubuntu:/opt/ibm/db2/V11.5/install# db2ls

Install Path             Level 	           Fix Pack
----------------------------------------------------
/opt/ibm/db2/V11.5       11.5.0.0           0

db2licm -l - To check the version installed. (IBM DB2 Developer-C Edition).

root@ubuntu:/opt/ibm/db2/V11.5/adm# ./db2licm -l
Product name:                     "IBM DB2 Developer-C 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"
Max amount of table space (GB):   "100"

Well, that's all. In the next post, I will create the instance and the sample database.