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:
- If your company has a Db2 license you normally download the software and license file from IBM Passport Advantage.
- If you already have a license file then you can obtain your software from https://www.ibm.com/support/pages/download-db2-fix-packs-version-db2-linux-unix-and-windows Just use the latest Fixpack from the release you want to install. Make sure you download the Linux 64-bit DB2 Universal Fix Pack for x86-64, AMD64 or Intel EM64T.
- If you want the free community edition then go to https://www.ibm.com/products/db2-database/developers to obtain a copy.
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
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.
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).
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.
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.