0% found this document useful (0 votes)
92 views

Downloading and Installing Db2 Developer-C On Ubuntu Linux: 1 Introduction: What Is Db2?

This document provides steps to download and install IBM Db2 Developer-C software on Ubuntu Linux. It includes prerequisites, downloading the software, preparing for installation, installing Db2, and testing the setup. The document is intended to help the reader set up a Db2 database named SAMPLE that can be used for application development and testing.

Uploaded by

Marco Jimenez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views

Downloading and Installing Db2 Developer-C On Ubuntu Linux: 1 Introduction: What Is Db2?

This document provides steps to download and install IBM Db2 Developer-C software on Ubuntu Linux. It includes prerequisites, downloading the software, preparing for installation, installing Db2, and testing the setup. The document is intended to help the reader set up a Db2 database named SAMPLE that can be used for application development and testing.

Uploaded by

Marco Jimenez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Downloading and installing Db2 Developer-C on

Ubuntu Linux
Roger E. Sanders
Shruthi Subbaiah Machimada
Published on October 23, 2018

This guide will help you download and install IBM® Db2® Developer-C software on Ubuntu
Linux, and then create a sample database. After completing the following steps, you will have a
Db2 v11.1.3.3 database named SAMPLE that can be used to develop and test applications.

Table of Contents
1 Introduction: What is Db2? ............................................................................................. 1
2 Prerequisites ................................................................................................................... 2
2.1 Hardware .............................................................................................................................2
2.2 Software ..............................................................................................................................2
3 Enabling root user access ................................................................................................ 3
4 Downloading the Db2 Developer-C software ................................................................... 4
5 Preparing for Db2 installation ......................................................................................... 9
6 Installing the Db2 software ............................................................................................. 9
7 Testing and validating setup ..........................................................................................22
7.1 Creating and querying the Db2 SAMPLE database .............................................................. 22
8 Summary .......................................................................................................................23
9 References .....................................................................................................................23

1 Introduction: What is Db2?


IBM Db2 is an enterprise-level, high-performance relational database management system
(RDBMS) that is designed to make the storage, management, and retrieval of data simple. Data
is stored in the form of tables consisting of rows (records) and columns (fields) and can be
retrieved or modified by any number of applications that are running concurrently. Access to,
and manipulation of data in a Db2 database is accomplished using Structured Query Language
(SQL) to store (INSERT), retrieve (SELECT), and manipulate (UPDATE and DELETE) data in a
RDBMS. SQL also provides facilities for defining database objects like tables, indexes, and
views, and for restricting data access.
2 Prerequisites
• Basic understanding of Linux operating system concepts

2.1 Hardware
• An Intel-based X86 server capable of supporting a 64-bit Operating System
• Monitor
• Keyboard
• Mouse

2.2 Software
• Ubuntu Linux 18.04 LTS (Desktop)* – The latest long-term support (LTS) version of
the Ubuntu Linux operating system. Download the Ubuntu Linux 18.04 software.
• Db2 Developer-C V11.1.3.3* – Free, fully functional version of Db2 intended for
development, test, and small production environments. (Get information on Db2 Direct
and Developer-C Editions.)
• libaio1 – Linux kernel asynchronous input/output (I/O) shared library. (Enables a single
application thread to overlap I/O operations with other processing, by providing an
interface for submitting one or more I/O requests in a single system call without waiting
for completion.)
• binutils – GNU Binary Utilities shared library. (A set of programming tools for creating
and managing binary programs, object files, libraries, profile data, and assembly source
code.)
• liblogger-syslog-perl – An interface to the UNIX program that sends messages to the
system logger, written in Perl. (Takes care of everything regarding Syslog
communication; provides one function for each of the following Syslog message levels:
debug, info, warning, error, notice, critic, and alert.)
• zlib1g-dev – A shared Linux library that implements the deflate compression method
found in gzip and PKZIP.
• libpam0g:i386 – Linux Pluggable Authentication Modules for Intel x86. (Enables the
local system administrator to choose how applications authenticate users.)
• libstdc++6:i386 – GNU Standard C++ Library, Version 3 for Intel x86. (A runtime
library for C++ programs built with the GNU compiler.)

A list of the most current versions of Db2 and Linux operating systems that have been tested
(together) can be found at the System requirements for IBM DB2 for Linux, UNIX, and
Windows web site.
3 Enabling root user access
(Duration: 1 minute)

When Ubuntu Linux 18.04 LTS is installed, root login is disabled by default. Db2 should be
installed under the root user account so follow these steps to enable root user access:

1. Log in with the user account that was created and given administrative privileges during
the OS installation.
2. Open a terminal window. (Right-click anywhere on the desktop and select Open
Terminal from the menu shown or press Ctrl + Alt + t).
3. Enter the command sudo passwd root.
4. When the prompt [sudo] password for [AdminUser]: (where AdminUser is
the user account that was used in Step 1) appears, enter the password for the
administrative user account and press Enter.
5. When the prompt Enter new Unix Password: appears, type a new password for
the root user and press Enter.
6. When the prompt Retype new Unix Password: appears, type the new password
again and press Enter. You should see the message passwd: password updated
successfully; if this message does not appear, go through the steps again, making
any corrections suggested by the error message or messages that are returned.
4 Downloading the Db2 Developer-C
software
(Duration: 5 minutes)

Follow these steps to download the Db2 Developer-C software (web page appearance may vary):

1. Open a web browser and go to the IBM Db2 Direct and Developer Editions web page.
(Figure 1).

Figure 1. IBM Db2 Direct and Developer Editions Web Page


2. Click the Try free developer edition button. This will open the IBM Db2 Developer
Editions download page (see Figure 2).

Figure 2. IBM Db2 Developer Editions download page

3. Click Try free edition for IBM Db2 Developer-C This will open a Sign Up for IBM
Db2 web page (Figure 3).
Figure 3. IBM Db2 Developer-C Sign Up page

4. If you already have an IBM ID, click the Sign in link and then enter your IBM ID and
password.
5. If you do not already have an IBM ID, enter the information requested, along with a
password; then click Continue.
6. Answer the questions on the Complete your profile page (Figure 4) and click Continue.
Figure 4. Complete your profile page

7. A Downloads page will open (Figure 5). Click the Download now link next to “IBM®
Db2 Developer-C Edition for Linux® on AMD64 and Intel® EM64T systems (x64)”.
Figure 5. IBM Db2 Developer Community Edition downloads page

8. Save the resulting file. You are now ready to install Db2 on your machine.

NOTE: You can perform sections 5 and 6 of this install guide manually or you can download
and run the Linux shell script that is available with this paper (in the file db2_env_setup.zip).
This script will perform all the steps outlined in these sections automatically. If you elect to
use the script, you must change its attributes before it can be executed (chmod 777
db2_env_setup.sh) and you must execute it as the root user. When the script is
finished, continue to the testing and validation procedures outlined in section 7 below.
5 Preparing for Db2 installation
(Duration: 10 minutes)

After root user access is enabled, you need to install the Linux shared library files that Db2
requires. It’s also a good idea to install the newest versions of all Linux packages that are
currently on the system. This can be done by performing the following steps:

1. Open a terminal window if you do not already have one open.


2. Execute the command su - root. When the Password prompt appears, provide the
password you created for the root user earlier. The command line prompt should change
from $ to #.
3. Execute the command apt-get upgrade to install the newest versions of all Linux
packages that are currently on the system.
4. Execute the following commands to install the prerequisite Linux packages:

• apt-get -y install libaio1


• apt-get -y install binutils
• apt-get -y install zlib1g-dev
• apt-get -y install liblogger-syslog-perl
• apt-get -y install libpam0g:i386
• apt-get -y install libstdc++6:i386

5. Execute the command apt-get update to update the list of all Linux packages that
are installed on the system.

6 Installing the Db2 software


(Duration: 10 minutes)

After the file containing the Db2 Developer-C software has been downloaded, you need to
extract the software from it, and then use the installation program provided to set up Db2. To do
that, follow these steps:

1. Open a terminal window if you do not already have one open.


2. Execute the command su - root; when the Password prompt appears, provide the
correct password for the root user.
3. Create a directory named “software” in the /home directory and execute the following
commands to make the software directory accessible to everyone:

a) mkdir /home/software
b) chmod 777 /home/software
4. Execute the command mv /home/AdminUser/Downloads/*.gz
/home/software (where AdminUser is the name of the administrative user). This will
move the file that was downloaded earlier to the directory created in the previous step.
5. Go to the /home/software directory and execute the following commands to unzip, and then
untar the file that was just copied there:

a) cd /home/software
b) gunzip *.gz
c) tar -xvf v11.1_linuxx64_dec.tar

When these commands are executed, a sub-directory named server_dec is created in the
/home/software directory, and the files that are used to install Db2 are extracted and stored in
this sub-directory.

6. Delete the .tar file that was created in the previous step. Make the sub-directory that was
created (server_dec) accessible to everyone, and then execute the following commands to
rename the sub-directory to ibm-db2:

a) rm -f v*.tar
b) chmod 777 server_dec
c) mv server_dec ibm-db2

7. Move to the /home/software/ibm-db2 directory and execute the following commands to


verify that the server has everything needed to install and run Db2:

a) cd ibm-db2
b) ./db2prereqcheck -v 11.1.3.3

Several messages are generated as different prerequisites for Db2 are checked; when all
checks are complete, you should see the following message: DBT3533I The
db2prereqcheck utility has confirmed that all installation
prerequisites were met. If you do not see this message, review the output of the
db2prereqcheck utility and resolve any problems identified.

8. Execute the command ./db2setup to load and start the Db2 Setup/Installation program.
When the Welcome window appears (Figure 6) click New Install.
Figure 6. Welcome window

9. A Choose a Product window will appear (Figure 7). Select DB2 Version 11.1.3.3 Server
Editions, then click Next. This launches the Db2 Setup/Install Wizard.
Figure 7. IBM Db2 Setup/Installation program product selection window

10. On the Configuration window of the Db2 Setup/Install Wizard, (Figure 8), click the Click to
view link to view the IBM terms. Then check the I agree to the IBM terms checkbox and
click Next.
Figure 8. IBM Db2 Setup/Install Wizard Configuration window

11. On the Instance Owner window (Figure 9), enter a password for the Db2 instance owner
(db2inst1) in the Password field. Then, enter the password again in the Confirm Password
field. (The instance owner user name and password provided is the user ID and password you
will use to work with Db2). Click Next.
Figure 9. IBM Db2 Setup/Install Wizard Instance Owner window

12. On the Fenced User window (Figure 10), enter a password for the Db2 fenced user
(db2fenc1) in the Password field. Then, enter the password again in the Confirm Password
field. (The fenced user is used to run user-defined functions and stored procedures outside of
the address space that is used by a Db2 database). Click Next.
Figure 10. IBM Db2 Setup/Install Wizard Fenced User window

13. On the Response File and Summary window (Figure 11), verify that the Install DB2 Server
Edition on this computer and save my settings in a response file radio button is selected.
Then click Finish to close the Wizard and start the Db2 installation process.
Figure 11. IBM Db2 Setup/Install Wizard Response File and Summary window

14. The Installing DB2 Server Edition window will appear (Figure 12). There are two status
bars, which show the progress of individual tasks and overall progress of the installation.
Figure 12. IBM Db2 Setup/Installation program status

15. When the Db2 installation process is complete, a Setup Complete window appears (see
Figure 13. Click Post-install steps. The Post-install steps window appears (see Figure 14).
Figure 13. IBM Db2 Setup/Installation Program Setup Complete

16. Carefully read the information shown in the Post-install steps window. This will tell you
how to:

• Verify that the Db2 software was installed correctly


• View your Db2 license entitlements
• Start using Db2
• Access the on-line Db2 documentation.

17. When you have finished reviewing the information provided in the Post-install steps
window, click Close.
Figure 14. IBM Db2 Setup/Installation Program post-install steps

18. After control returns to the Setup Complete window, you can review the contents of the log
file generated during the Db2 installation process. If you want to review this log file, click
Log file to open the Log file viewing window (Figure 15).
Figure 15. IBM Db2 Setup/Installation Program log file

19. When you have finished reviewing the log information, click Close. You are returned to the
Setup Complete window. To close the Db2 Setup/Installation program, click Finish (as
shown in Figure 16).
Figure 16. Exiting the IBM Db2 Setup/Installation Program Setup Complete window

This ends the Db2 Setup/Installation program and returns control to the operating system.
7 Testing and validating setup
The following section documents a simple test to verify that the software components used to set
up the environment described earlier were installed correctly.

7.1 Creating and querying the Db2 SAMPLE database


(Duration: 5 minutes)

Db2 comes with a sample database that, when created, can be used for a variety of purposes,
including development and testing simple applications that interact with Db2. Most of the sample
application programs found in the directory /home/Db2InstanceUser/sqllib/samples (where
Db2InstanceUser is the name assigned to the user that was created as the instance owner during
Db2 installation) work with this sample database. (Get information about the Db2 sample
database).

Follow these steps to create the Db2 sample database and run a simple query against it:

1. Open a terminal window if you do not already have one open.


2. Execute the command su – db2inst1.

NOTE: This assumes the instance owner name is “db2inst1”. If you used the install script or
followed the instructions in Step 4, sub-step 11, it will be. However, you can specify a different
name when installing Db2 – if that is the case, use the appropriate instance owner name.

3. When the prompt Password: appears, enter the password created for the instance
owner (db2inst1) during Db2 installation and press Enter.
4. Execute the command db2start. This starts the Db2 database manager background
processes; if these processes started successfully, you should see a message that looks
like this: SQL1063N DB2START processing was successful. (If the Db2
database manager is already running, the message looks like this instead: SQL1026N
The database manager is already active.)
5. Execute the command db2sampl –force -sql. This creates a Db2 sample database
that does not contain XML data. The database is named SAMPLE and if a database with
this name already exists, that database will be deleted before the new SAMPLE database
is created. (It should take approximately 2 to 5 minutes to create the database.)
6. When the SAMPLE database is created, you should see a message that says
'db2sampl' processing complete.
7. Execute the command db2 connect to sample. When this command is executed,
you should see a message that looks like this:

Database Connection Information


Database server = DB2/LINUXX8664 11.1.3.3
SQL authorization ID = DB2INST1
Local database alias = SAMPLE

8. After a database connection is established, retrieve the contents of a table named


DEPARTMENT that was created in the database by executing the command db2
“select * from department” (be sure to include quotes around the text that
follows db2). You should be presented with fourteen rows of data along with the
message 14 record(s) selected.
9. Execute the command db2 connect reset to terminate the database connection.
You should see the message DB20000I The SQL command completed
successfully.

8 Summary
If you successfully completed the steps outlined here, you will have an Ubuntu Linux
environment that can be used to develop applications that interact with the SAMPLE database
provided with Db2. You can also create other databases and database objects to work with, as
well as explore the different features that has Db2 to offer. To learn more about these features,
refer to the IBM Db2 Version 11.1 Knowledge Center.

9 References
Db2 database product documentation

Db2 samples on GitHub

You might also like