Check all articles

Installation of DB2 11 on CentOS 7

In this short guide we are going to install the IBM DB2 database engine version 11.1 for LUW (Linux, Unix, Windows) on CentOS 7.

Important Note: This installation can be used for a development environment, application testing or as a laboratory to evaluate some functionality of this software. It should not be used for groups of developers, do not consider for production environments. Since it is necessary to dimension the workload that the database will perform through a capacity planning to have a correct configuration.


Prepare the server

To install CentOS 7 you can execute the following procedure. For the installation of the database engine I am using a VM upon Oracle Virtual Box with a minimum configuration of: 2 vCPUs, 4 GBytes de RAM, 40 GBytes HD and "bridge adapter" for the network interface.

From the terminal on the command line, connect with the root user:

$su -

Check if SELinux is active, with the command:

#sestatus

If SELinux is in the disabled state, it is ok ... otherwise we must disable SELinux. For this, edit the configuration file and set SELINUX=disabled

#vi /etc/selinux/config

A good practice is always to have the latest updates installed, use the command:

#yum -y update

Also, install the following packages:

#yum -y install cpp.x86_64 gcc.x86_64 gcc-c++.x86_64 libstdc++.i686 pam.i686

Restart the server:

#shutdown -r now

Connect to the root user, after the reboot:

$su -

Verify again the status of SELinux (it must be disabled):

#sestatus

Verify the ip address of the VM:

#ifconfig

Add the port 50000 to the Firewall, from the menu of Applications->Sundry->Firewall, add to the public zone the port 50000 in "runtime" and "permanent". Once, we add the port choose from the top of the screen Options and click on Reload Firewalld. The port 50000 is used for DB2 remote conections, if you have a problem trying to connect to DB2 disable temporary the firewall during the installation process.

Get the version of DB2 11 for Linux

From this url here, you can download the DB2 installer for Linux 64 bits. In this portal you have to register first in order to get an user and password. The download is free, the file name is v11.1_linuxx64_server_t.tar.gz

We can save the file in the Downloads folder of the user that we are connected to.

Open the terminal with the command line and connect with the root user:

$su -

Enter to the folder where the file is (in my case):

#cd /home/juanleon/Downloads

Unzip the file with the command:

#tar -xzvf v11.1_linuxx64_server_t.tar.gz

Start the installation

After unzipping the file a server_t folder is created, enter to this directory.

Execute the following command to know if the server complies with the installation requirements:

./db2prereqcheck -v 11.1.0.0 -s -o /tmp/db_check11.1a.log

The system shows a message that the requirements are met and a warning about the "kernel-source", do not consider the warning because this requirement is necessary when we want to install pureScale, that funcionality is not part of this guide.

It would be used the command db2_install if you want to perform the installation by command line, but I will do it using the graphical interface, use the command:

./db2setup

The following image is showed when the installer is booting.

DB2OnCentOS7_Screen1

Click on the New Install button:

DB2OnCentOS7_Screen2

Select DB2 Version 11.1.1.1 Server Editions and click on Next button

DB2OnCentOS7_Screen3

The directory where our software is going to be installed is displayed (/opt/ibm/db2/V11.1), check "Create an instance" and "I agree to the IBM terms" then click on Next button:

DB2OnCentOS7_Screen4

The user who owns the db2 instance by default is db2inst1, do not change anything just type the password:

DB2OnCentOS7_Screen5

Once, you have re-typed the password, click on Next button:

DB2OnCentOS7_Screen6

Let's set up an user db2fenc1 for creating our own functions and stored procedures, type the password:

DB2OnCentOS7_Screen7

A summary screen appears, Click the Finish button.

DB2OnCentOS7_Screen8

The installation process begins.

DB2OnCentOS7_Screen9

A few minutes later, the installation is completed. Click on the Finish button.

DB2OnCentOS7_Screen10

Verify the installation

So far you've just installed the database engine ... create the sample database that comes with the installer, execute:

#./opt/ibm/db2/V11.1/bin/db2sampl

After the creation of the database, validate that everything is ok, execute the command:

#./opt/ibm/db2/V11.1/bin/db2val

Test your local connection from the server using:

#su - db2inst1

Call the DB2 command line terminal using:

$db2

Connect to the database:

db2 => connect to SAMPLE

It appears information of the connection where everything is correct, list the tables:

db2 => list tables

And disconnect from the database.

db2 => quit

Remote connection from a client

Use the IBM Data Studio client or other DB2 database client for testing a remote connection using: ip_address, port 50000, the name of the SAMPLE database, the user of the db2inst1 instance and the password.

And Ready!!!

We can start working with the IBM DB2 11.1 database engine in CentOS 7.