Installing Db2 on Ubuntu

Last modified: December 6, 2021
You are here:

Server pre-requisites

This article assumes that you will be using the latest Ubuntu LTS. Make sure you install the 64-bit Intel/AMD server (aka x86-64 or AMD64) server install image. If you are just playing around with Db2 you can use a desktop image for production use we advise a headless (no desktop) version of Ubuntu. Installation can be done from the console (local) or SSH session (remote).

Obtain the Db2 Software

There are three possible sources for download:

In all cases, you need to log in with your ibm-id (which you can create for free). Transfer the downloaded file, which has a name like v<rr.mm>fp<x>_linuxx64_server_t.tar.gz, to your home directory.

Untar the download file

First, untar the file (it is a lot so it can take a while):

tar -xzf vRR.MfpX_linuxx64_server_t.tar.gz

After the untar of the software go into the server_t directory

cd server_t
Although it is possible to install Db2 as a non-root user we strongly recommend using root in order to install to prevent problems with future upgrades. So in order to install you need to be a sudo user. In the examples we prefix each command with sudo but it is also possible to continue the install as root using sudo su –

Install the missing server components needed by Db2

To verify is all software needed by Db2 is installed on the server issue:

sudo ./db2prereqcheck -l 

This will produce a report on missing software. You can safely ignore any reference to gcc, binutils, cpp, gcc-c++, and kernel-source. They are needed only to compile the IBM General Parallel File System (GPFS) Portability Layer (GPL) module which is used by the Db2 Purescale feature.

Very likely you need to install some missing modules. Here is the common list for Ubuntu:

sudo apt-get install libx32stdc++6
sudo apt-get install libpam0g:i386
sudo apt-get install libaio1

Some Db2 tools use Java. The install process will check if the Java Runtime Engine (JRE) is installed and if not it will install a local copy for Db2. This is why db2prereqcheck does not report it as missing. But it is wise to have the JRE maintained by regular patch process so install it also:

sudo apt-get install default-jre

If you have downloaded an older release of Db2 (e.g. 10.5 in order to do some testing) it is possible the db2prereqcheck reports that only older Ubuntu releases are supported. In general, you can ignore these messages. Many users have reported that no problems exist with latest Ubuntu release and an older Db2 release.

After you installed the missing software repeat the db2prereqcheck command again to make sure you are not missing anything

Install the Db2 software

If you intend to use Tivoli System Automation (TSA) then install this software before installing Db2.

Db2 offers two installation procedures:

  • db2setup is a graphical setup. It is meant for a desktop environment. Often when you forward the X11 output to an SSH Client with a built-in X-Server (e.g. MobaXterm) the setup process does not start or hangs in the middle of the install. We advise you using this command only in a desktop environment.
  • db2_install which is the console-based procedure. In this article, we will use this one.

Issue:

sudo ./db2_install

First, the install asks to accept the license agreement. The second question is the default install directory (/opt/ibm/db2/Vrr.mm) which is wise to keep (future products and examples on the internet might refer to it). Then the final question is what exactly you want to install. The answer is "server".

Finally the install process will go through almost 60 steps. The initial time estimation is way too high. Some steps only take a few seconds but there are a few that take longer than a minute. Especially The process keeps you informed what it is doing.

Review the install log file

The install process will produce a log text file in /tmp (see last output messages).

An extended log file is produced in /opt/ibm/db2/Vrr.mm/install/logs/db2install.history. It has all the info from the /tmp log-file but also more detailed info about installed software. Always carefully review this file. If the install is aborted then it is possible only one of the two log files is produced.

Verify the Db2 install

After the install process is completed it is recommended you verify the install:

sudo /opt/ibm/db2/Vrr.m/bin/db2val -o

This process produces a log-file in /tmp you have to review.

Next steps

After install is complete you have to create an instance and database(s) in the instance. For test purposes you can create a sample database using the db2sampl command.

Once the Db2 software is successfully installed you can remove the <server_t> directory. All the software will be in the /opt/ibm/db2 directory.
Was this article helpful?
Dislike 0
Views: 3032