Login to your EC2 instance and verify the distribution version
$ ssh -i ibm-db2.pem ubuntu@54.234.180.34
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focalDownload and extract Db2 community edition tarball on EC2 instance You can download the community edition from this URL
Download the latest IBM Db2 Linux (x64) version in your local machine
Once download is completed, copy the downloaded file to your EC2 instance
Sun Apr 30 04:51:27 2023 Checking prerequisites for DB2 installation. Version "11.5.8.0". Operating system "Linux"
Validating "kernel level " ... Required minimum operating system kernel level: "3.10.0". Actual operating system kernel level: "5.15.0". Requirement matched.
Validating "Linux distribution " ... Required minimum "UBUNTU" version: "16.04" Actual version: "20.04" Requirement matched.
Validating "ksh symbolic link" ... WARNING : Requirement not matched. ERROR: The 'strings' utility that is used to detect prerequisite libraries is not present on this system. Please use your package or software manager to install the GNU Binary Utilities.
Validating "C++ Library version " ... Required minimum C++ library: "libstdc++.so.6" Standard C++ library is located in the following directory: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28". DBT3512W The db2prereqcheck utility failed to determine the currently-installed version of the C++ standard library, libstdc++. Requirement matched.
Validating "libaio.so version " ... DBT3553I The db2prereqcheck utility successfully loaded the libaio.so.1 file. Requirement matched.
Validating "libnuma.so version " ... DBT3610I The db2prereqcheck utility successfully loaded the libnuma.so.1 file. Requirement matched.
Validating "/lib/i386-linux-gnu/libpam.so*" ... DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/i386-linux-gnu/libpam.so*". WARNING : Requirement not matched. Requirement not matched for DB2 database "Server" . Version: "11.5.8.0". Summary of prerequisites that are not met on the current system: DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/i386-linux-gnu/libpam.so*".
DBT3619W The db2prereqcheck utility detected that ksh is not linked to ksh or ksh93. This is required for Db2 High Availability Feature with Tivoli SA MP.
From the above output we can see the requirement checks are failed and we need to fix them
Enable 32-bit architecture on your instance and install the required packages
Validating "C++ Library version " ... Required minimum C++ library: "libstdc++.so.6" Standard C++ library is located in the following directory: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28". Actual C++ library: "CXXABI_1.3.1" Requirement matched.
Validating "32 bit version of "libstdc++.so.6" " ... Found the 64 bit "/lib/x86_64-linux-gnu/libstdc++.so.6" in the following directory "/lib/x86_64-linux-gnu". Found the 32 bit "/lib32/libstdc++.so.6" in the following directory "/lib32". Requirement matched.
Validating "libaio.so version " ... DBT3553I The db2prereqcheck utility successfully loaded the libaio.so.1 file. Requirement matched.
Validating "libnuma.so version " ... DBT3610I The db2prereqcheck utility successfully loaded the libnuma.so.1 file. Requirement matched.
Validating "/lib/i386-linux-gnu/libpam.so*" ... Requirement matched. DBT3533I The db2prereqcheck utility has confirmed that all installation prerequisites were met.
Multiple installation methods available for Db2 for specific use cases
We are going to install Db2 using db2_install command as root user and wait for the installation to complete
$ sudo ./db2_install Read the license agreement file in the db2/license directory.
*********************************************************** To accept those terms, enter "yes". Otherwise, enter "no" to cancel the install process. [yes/no] yes
Default directory for installation of products - /opt/ibm/db2/V11.5
*********************************************************** Install into default directory (/opt/ibm/db2/V11.5) ? [yes/no] yes
Specify one of the following keywords to install DB2 products.
SERVER CONSV CLIENT RTCL
Enter "help" to redisplay product names.
Enter "quit" to exit.
*********************************************************** SERVER *********************************************************** Do you want to install the DB2 pureScale Feature? [yes/no] no DB2 installation is being initialized.
Once the installation is completed, you will see the below message and we can check the installation log file for post installation steps
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2_install.log.5295".
Required steps: Set up a DB2 instance to work with DB2.
Optional steps: Notification SMTP server has not been specified. Notifications cannot be sent to contacts in your contact list until this is specified. For more information see the DB2 administration documentation.
To validate your installation files, instance, and database functionality, run the Validation Tool, /opt/ibm/db2/V11.5/bin/db2val. For more information, see "db2val" in the DB2 Information Center.
Let’s validate our installation by executing the db2val command and verify the log file We can see that everything is OK
$ sudo /opt/ibm/db2/V11.5/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 was successful.
DBI1343I The db2val command completed successfully. For details, see the log file /tmp/db2val-230430_051357.log.
$ cat /tmp/db2val-230430_051357.log Installation file validation for the DB2 copy installed at "/opt/ibm/db2/V11.5" starts.
Task 1: Validating Installation file sets. Status 1 : Success
Task 2: Validating embedded runtime path for DB2 executables and libraries. Status 2 : Success
Task 3: Validating the accessibility to the installation path. Status 3 : Success
Task 4: Validating the accessibility to the /etc/services file. Status 4 : Success
DBI1335I Installation file validation for the DB2 copy installed at /opt/ibm/db2/V11.5 was successful.
Installation file validation for the DB2 copy installed at "/opt/ibm/db2/V11.5" ends.
DBI1343I The db2val command completed successfully. For details, see the log file /tmp/db2val-230430_051357.log.
$ sudo passwd db2inst1 New password: Retype new password: passwd: password updated successfully
$ sudo passwd db2fenc1 New password: Retype new password: passwd: password updated successfully
$ sudo passwd dasusr1 New password: Retype new password: passwd: password updated successfully
Create an instance for Db2 using db2icrt command and verify the log file for information about connecting to database
$ sudo /opt/ibm/db2/V11.5/instance/db2icrt -a server -u db2fenc1 db2inst1 DBI1446I The db2icrt command is running.
DB2 installation is being initialized.
Total number of tasks to be performed: 4 Total estimated time for all tasks to be performed: 309 second(s)
Task #1 start Description: Setting default global profile registry variables Estimated time 1 second(s) Task #1 end
Task #2 start Description: Initializing instance list Estimated time 5 second(s) Task #2 end
Task #3 start Description: Configuring DB2 instances Estimated time 300 second(s) Task #3 end
Task #4 start Description: Updating global profile registry Estimated time 3 second(s) Task #4 end
The execution completed successfully.
For more information see the DB2 installation log at "/tmp/db2icrt.log.85927". DBI1070I Program db2icrt completed successfully.
$ cat /tmp/db2icrt.log.85927
Required steps: You can connect to the DB2 instance "db2inst1" using the port number "25000". Record it for future reference.
Let’s start the database instance using the below commands
$ sudo su - db2inst1
$ db2ls
Install Path Level Fix Pack Special Install Number Install Date Installer UID --------------------------------------------------------------------------------------------------------------------- /opt/ibm/db2/V11.5 11.5.8.0 0 Sun Apr 30 05:08:04 2023 UTC 0
$ . sqllib/userprofile
$ db2ilist db2inst1
$ db2start 04/30/2023 05:36:30 0 0 SQL1063N DB2START processing was successful. SQL1063N DB2START processing was successful.
Now the database instance is started and we can connect to the instance
$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 11.5.8.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 =>
Create a test database and connect to the database using the below commands
db2 => create database ibm DB20000I The CREATE DATABASE command completed successfully.
db2 => connect to ibm
Database Connection Information
Database server = DB2/LINUXX8664 11.5.8.0 SQL authorization ID = DB2INST1 Local database alias = IBM
Enable automatic start of database instance after reboot Execute the below commands as db2inst1 user
Connect to our test database and we can see everything is OK
$ db2 (c) Copyright IBM Corporation 1993,2007 Command Line Processor for DB2 Client 11.5.8.0
You can issue database manager commands and SQL statements from the command prompt. For example: db2 => connect to sample db2 => bind sample.bnd
For general help, type: ?. For command help, type: ? command, where command can be the first few keywords of a database manager command. For example: ? CATALOG DATABASE for help on the CATALOG DATABASE command ? CATALOG for help on all of the CATALOG commands.
To exit db2 interactive mode, type QUIT at the command prompt. Outside interactive mode, all commands must be prefixed with 'db2'. To list the current command option settings, type LIST COMMAND OPTIONS.
For more detailed help, refer to the Online Reference Manual.
db2 => connect to ibm
Database Connection Information
Database server = DB2/LINUXX8664 11.5.8.0 SQL authorization ID = DB2INST1 Local database alias = IBM