Installing Db2 on AIX or Linux by using the command-line

You can install Db2® on AIX® or Linux® operating systems by using commands.

Before you begin

Ensure that you have:
  • 2 - 3 GB of hard disk drive space for the Db2 installation tar file and extracted files.
  • A file system with at least 30 GB for the IBM Spectrum® Control repository.

Procedure

To install Db2 on AIX or Linux operating systems by using a command line, complete the following steps:

  1. Log in with a user ID that has root authority.
  2. Install Db2.
    1. Create a temporary directory (for example, db2temp) to hold the Db2 installation image and extracted files.
    2. Copy or download the Db2 installation image into db2temp. The name of the file varies depending on the location from where the file is downloaded or copied and the language to which it is associated.
    3. Use an extraction tool to extract the installation image files.
      For example, if the name of the file is v11.5_aix64_server.tar.gz, enter tar -zxf v11.5_aix64_server.tar.gz. In this example, v11.5_aix64_server.tar.gz is extracted in the db2temp directory.
    4. Change directory to the location of the Db2 installation program: db2_install.
    5. Enter ./db2_install to run the command-line installation program.
    6. Enter yes to accept the license agreement terms.
    7. Enter yes to install into the default directory; enter no to install into a directory you specify.
    8. Enter SERVER for the Db2 product to install.
    9. Enter no because you do not want to install the Db2 pureScale® feature.
      The Installation Summary is displayed, which indicates a completed installation. Errors related to the install of the TSAMP file set can be ignored.
  3. Create users and groups for Db2 on AIX.
    1. Enter the following commands to create the Db2 groups:
      mkgroup db2iadm1
      mkgroup db2fadm1
    2. Enter the following commands to create the Db2 users and assign them to the Db2 groups:
      mkuser pgrp=db2iadm1 groups=db2iadm1 home=/home/db2inst1 db2inst1
      mkuser pgrp=db2fadm1 groups=db2fadm1 home=/home/db2fenc1 db2fenc1
    3. Enter the following commands to set the correct ownership on the Db2 users' home directories:
      chown -R db2inst1:db2iadm1 /home/db2inst1
      chown -R db2fenc1:db2fadm1 /home/db2fenc1
    4. Enter the following commands to set the password for the Db2 user db2inst1:
      passwd db2inst1
      pwdadm -f NOCHECK db2inst1
    5. Enter the following commands to set the password for the Db2 user db2fenc1:
      passwd db2fenc1
      pwdadm -f NOCHECK db2fenc1
    6. Enter the following command to add the Db2 user db2inst1 to the groups staff and system:
      usermod -G staff,system db2inst1
  4. Create users and groups for Db2 on Linux:
    1. Enter the following commands to create the Db2 groups:
      groupadd db2iadm1
      groupadd db2fadm1
    2. Enter the following commands to create the Db2 users:
      useradd db2inst1
      useradd db2fenc1
    3. Enter the following commands to assign the Db2 users to the Db2 groups:
      usermod -a -G db2iadm1 db2inst1
      usermod -a -G db2fadm1 db2fenc1
    4. Enter the following commands to set the correct ownership on the Db2 users' home directories:
      chown -R db2inst1:db2iadm1 /home/db2inst1
      chown -R db2fenc1:db2fadm1 /home/db2fenc1
    5. Enter the following command to set the password for the Db2 user db2inst1:
      passwd db2inst1
    6. Enter the following command to set the password for the Db2 user db2fenc1:
      passwd db2fenc1
    7. Enter the following command to add the Db2 user db2inst1 to the group root:
      usermod -a -G root db2inst1
  5. Create a Db2 instance named db2inst1:
    1. Change directory to <Db2_installation_dir>/instance.
    2. Enter the command:
      ./db2icrt -a server -u db2fenc1 db2inst1
    3. Enter the command:
      . /home/db2inst1/sqllib/db2profile
    4. Enter the command:
       db2start
  6. Configure Db2 communication.
    1. Examine the /etc/services file. If the line db2c_db2inst1 25010/tcp exists in that file, proceed to Step 7. If the line db2c_db2inst1 25010/tcp does not exist in that file, do the following:
    2. Edit the /etc/services file and add the following line at the end of the file: db2c_db2inst1 25010/tcp.
    3. Enter the command:
      db2 update dbm cfg using svcename db2c_db2inst1
    4. Enter the command:
      db2set DB2COMM=tcpip
    5. Enter the command:
      db2stop
    6. Enter the command:
      db2start
  7. Enter the command: db2level to verify the installed version of Db2.