Downloading and Installing Db2 Developer-C On Ubuntu Linux: 1 Introduction: What Is Db2?
Downloading and Installing Db2 Developer-C On Ubuntu Linux: 1 Introduction: What Is Db2?
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
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).
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:
5. Execute the command apt-get update to update the list of all Linux packages that
are installed on the system.
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:
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
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:
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.
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:
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:
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