This is the second article in a series of articles on getting started with IBM's Db2 Database, a Relational Database Management System (RDBMS) that is part of a collection of data management and analysis software. The first article of the series -- Getting Started with IBM DB2 on Linux Part I: Background and Installation Preparation, discussed downloading the installation image, preparation for installation, and the available installation methods. The current article describes one of the installation methods -- the Db2 Setup GUI wizard. This method can be used on a Linux system with a fully configured desktop environment so that the wizard GUI is displayed directly on the target computer, or on a system without a desktop environment but with X Window System client software, so that the GUI is displayed on and inputs received from a remote computer. Both scenarios are discussed.
The wizard installs the the Db2 Database software, by default to /opt/ibm/db2/V11.5, which can be overriden in the wizard. This populating of the /opt/ibm/db2/V11.5 is also done by the other installation methods, but the wizard performs other tasks to simplify getting started with Db2 Database. It:
The concepts of an instance, instance owning user, and instance owning fenced user are central to the operation of Db2 Database and are discussed in Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts But to briefly describe them here, an instance is one containment level within the hierarchical containment levels of Db2 Database. The instance level containment is a separate self-contained database environment consisting of RDBMS configuration, RDBMS program execution, and RDBMS managed data. Db2 Database supports the installation of multiple copies of the software on a single computer. For each installation of the software, multiple instances that are associated with the specific copy of the database software are supported. Within the instance can be multiple databases and within the databases lower level database objects, such as tables, indexes, and views, etc.
Section Installing on Machine with a Desktop Environment Using Wizard, below, the process of installing Db2 Database in an Ubuntu 18.04 VM with a fully configured desktop environment is described. This configuration includes the underlying setup of the X Window System -- both client and server, so we can run the DB2 Setup wizard and the wizard's window will appear as any other application's window running on the machine. In Section Installing on Machine without a Desktop Environment Using Wizard, further below, the process of installing Db2 Database on the Ubuntu 18.04 VM without a desktop environment, also using the wizard is described. However, in this case, while the wizard is executed directly on the VM through an SSH connection, the wizard's GUI window will be displayed on the computer from which we have established the SSH connection to the VM. Here, the installation is performed on a VM running on a local computer (the VM host) through an SSH connection from the local computer to the VM guest (remote computer). While in the previous scenario both X Window System server and client software are available, in this case at least X Window System client software needs to be installed.
The Db2 Setup wizard executable is in the same directory as the prerequisite checking tool mentioned in the last part of this article series. We run it using the following steps directly on the target computer using its desktop environment.
db2user@u1804-lab:~$ su - root
root@u1804-lab:~# cd /home/db2user/software/ibm_db2Remember that /home/db2user is the home folder created to perform the installation. Adjust the above for your case.
Upon executing the wizard on a system with a fully configured desktop environment, such as the Kubuntu 18.04 VM, the window shown in the first image of the following set of screenshots is be displayed. The subsequent images show the following screens of the installer. Click on any of the thumbnails for a slideshow of each screen of the installer. The most notable screens of the wizard are described below.
useraddLinux utility. The home directory of the instance owner will contain the configuration files of the instance as well as all the files that actually hold the data of the instances databases. (For a description of instances, how they relate to instance owning users, and the important directories of Db2 see Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts.)
All screens and options of the GUI wizard executed on the remote computer but displayed on the local computer is exactly the same as in the previous installation on a computer with a desktop environment.
The previous section described the process of installing Db2 Database using the wizard directly on a computer with a fully configured desktop environment -- in this case the Kubuntu 18.04 implementation of KDE's Plasma. This section describes the installation process using the DB2 Setup wizard on a target computer which does not have a desktop environment by remotely connecting to it through an SSH connection but displaying and interacting with the wizard's GUI on the local computer. This method relies on the X Window System's power as a client/server network application, where applications with GUI's are X clients which display their windows on a computer with an X server. Even when programs are executed and displayed on the same computer as in the previous section, applications use the X client software to connect to and display their output and receive interaction via mouse and keyboard using the X server running on the same computer. Although the X window system is capable of this remote capability on its own, an SSH connection is used to forward the display to the local computer in order to simplify the X communication configuration as X forwarding is built into SSH. The process is described below.
db2user@u1804-lab:~$ hostname -f u1804-lab.localdomain
20:24:54 θ68° [brook@G5-openSUSE:~] $ xhost + u1804-lab.localdomain xhost: bad hostname "u1804-lab.localdomain". The above command without specifying a specific host will allow any remote host to display windows on the local computer. By specifying a specific host, only the indicated remote host, u1804-lab.localdomain will be allowed to display windows on the local computer, reducing security risks.
20:27:38 θ67° [brook@G5-openSUSE:~] $ ssh -X -i /home/brook/DataEXT4/ssh/id_ed25519_db2user firstname.lastname@example.org
DISPLAYenvironment variable on the remote host is configured by the ssh client through the use of the
- Xoption when invoking ssh.
db2user@u1804-lab:~$ echo $DISPLAY localhost:10.0If not using X forwarding through SSH and using X's native forwarding the
DISPLAYenvironment variable would have to be configured manually.
-Xoption will display the GUI window on the local computer even though it is executed in the remote computer. So, now the DB2 Setup wizard can be started on the remote machine and have the window displayed on the local computer. The setup wizard must be executed as the root user with the root user's profile. However doing so at this point will not work because the SSH connection is for the user for which the SSH connection and X forwarding was established, in this case db2user. To allow the setup wizard to be executed as root and the wizard's GUI to be forwarded with the SSH connection established for the regular user, continue with the following steps.
db2user@u1804-lab:~$ xauth list $DISPLAY u1804-lab/unix:10 MIT-MAGIC-COOKIE-1 9a3e54b3607a593b75cd14b27f808742This shows that for the forwarded session the DISPLAY environment variable is u1804-lab/unix:10 and the authorization cookie for the current session and user that initiated the SSH connection is the string following MIT-MAGIC-COOKIE-1. The magic cookie is also stored in binary form in the user's home directory in the file ~/.Xauthority. To allow the X window created when a program is executed as root to be forwarded through SSH, the same magic cookie must be placed in root's .Xauthority with the
db2user@u1804-lab:~$ su - root Password: root@u1804-lab:~#
root@u1804-lab:~# touch /root/.Xauthority
root@u1804-lab:~# xauth add u1804-lab/unix:10 MIT-MAGIC-COOKIE-1 9a3e54b3607a593b75cd14b27f808742The argument to
xauth addis the same as the output to
xauth list $DISPLAYin Step 5, above. Now the DB2 Setup wizard can be started as root and the wizard's window will be forwarded to the local computer's X server through the SSH connection created by the regular user.
root@u1804-lab:~# cd /home/db2user/software/ibm-db2
Upon starting the installer wizard on the remote computer through the SSH connection, the graphical output is displayed on the local computer; the wizard's splash screen is displayed followed by a license notice, then the first screen of the wizard, as depicted by the first image in the following set of screenshots.
Each of the installations of Db2 includes a tool to validate the installation and the instance of the RDBMS created by the installer in each installation directory. For the first installation, with the wizard directly on the machine with the desktop environment, the process for which was detailed in the section Installing Directly on a Computer with a Desktop Environment Using Db2 Setup Wizard, the installation directory is at /opt/ibm/db2/V11.5. And for the second installation, where the wizard was invoked remotely through an SSH connection and the wizard's window was forwarded to the local computer through the connection, detailed in the section Installing on a Remote Computer Without a Desktop Environment Using Db2 Setup Wizard, the installation is at /opt/ibm/db2/V11.5_01.
The validation tool for each installation is located in the bin subdirectory of each installation directory. The tool must be executed as the instance owning user of the instance created with each installation, db2inst1 and db2inst2, for the first and second installations, respectively. (As we will see in Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts any user added to the primary user groups of the instance owning users can also run these tools). To validate the fist installation and the instance created by the first installation:
root@u1804-lab:/home/db2user/software/ibm-db2 # su - db2inst1The creation of the instance and the instance owning user during the first use of Db2 Setup was shown in Image 11 of the first set of screenshots.
$ cd /opt/ibm/db2/V11.5/binNote that the login shell assigned to users created by the wizard is the Bourne Shell, a capability provided by dash on Ubuntu, due to the default configuration of the useradd utility. This is the reason for the simple
$shell prompt. When creating an instance and the necessary instance users in Getting Started with IBM DB2 on Linux Part III: Manual Installation, Bash is assigned as their login shell.
The output of the tool is shown below for a successful installation and instance creation.
DBI1379I The db2val command is running. This can take several minutes. DBI1335I Installation file validation for the DB2 copy installed at /opt/ibm/db2/V11.5 was successful. DBI1339I The instance validation for the instance db2inst1 was successful. DBI1343I The db2val command completed successfully. For details, see the log file /tmp/db2val-201230_201241.log.
The second installation can be validated similarly, by first switching to db2inst2 and running the tool as shown in the following listing.
root@u1804-lab:/home/db2user/software/ibm-db2# su db2inst2 $ cd /opt/ibm/db2/V11.5_01/bin $ ./db2val DBI1379I The db2val command is running. This can take several minutes. DBI1335I Installation file validation for the DB2 copy installed at /opt/ibm/db2/V11.5_01 was successful. DBI1343I The db2val command completed successfully. For details, see the log file /tmp/db2val-210111_191439.log. $
The DB2 Setup wizard installs a copy of DB2, by default in /opt/ibm/db2 in a directory named after the version of DB2 being installed, in this case V11.5, such that the full path of the first installed copy of DB2 is at /opt/ibm/db2/V11.5. Subsequent installations of the same version of will have an underscore and a monotonically increasing two digit number appended beginning with _01, as was the case for the second installation. (For a description of installation fo multiple copies of Db2 and its containment hierarchy, see Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts. Information on the installation can be viewed with a tool included with the installation, available to all users as it is located in /usr/local/bin, a path that is set in the environment variable PATH of all users by default in Ubuntu based systems.
db2user@u1804-lab:~$ db2ls Install Path Level Fix Pack Special Install Number Install Date Installer UID --------------------------------------------------------------------------------------------------------------------- /opt/ibm/db2/V11.5 188.8.131.52 0 Tue Dec 29 18:36:57 2020 EST 0 /opt/ibm/db2/V11.5_01 184.108.40.206 0 Sun Jan 10 20:11:01 2021 EST 0 db2user@u1804-lab:~$
This population of this path is performed by the other installation methods as well, but the wizard also performs some configuration that simplifies getting started with Db2 Database. It optionally creates one instance of the RDBMS to be associated with the installed copy of the Db2 Database server software, which for the first created instance is named db2inst1. It creates an instance owing user and instance fenced user, db2inst1 and db2fenc1, respectively. The instance home directory is the instance owner's directory, /home/db2inst1. Other important instance specific directories exist in this instance home and are discussed in Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts. Paths for each instance user are set by sourcing a script within one of these instance home directories, and is also discussed in Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts.
The installation of Db2 Database using the wizard simplifies the installation and subsequent configuration of Db2. It creates one instance and the necessary users, configuring even network communication to the instance, allowing users to immediately start using the instance. However, it can only create one instance. If multiple instances are required to be associated with an installed copy, they must be created manually or created using a response file installation. Creating instances and manual installation by extracting the payload file, using the db2_install command, and using the response file are discussed in the next part of this article series, Getting Started with IBM DB2 on Linux Part III: Manual Installation .
An additional issue is that before interacting with the instance, the appropriate environment variables must be set. The environment variables and the tools provided by Db2 to automate their setting, as well as the other fundamental concepts of Db2 Database is the subject of Getting Started with IBM DB2 on Linux Part IV: Fundamental Concepts