After verifying that your system meets the basic requirements, you should plan your installation by considering installation methods and the creation of users and groups:
After downloading and extracting the tar.gz file, the file tree looks like this:
exp/ -| disk1/ -| db2_install (* command line installation script *) db2setup (* GUI installation launcher *) installFixPack (* not applicable for Express-C *) db2/ -| (* installation and licensing files *) doc/ -| (* install instructions and release notes *) |
You can use three methods to install DB2:
db2setup utility
db2_install utility
a DB2 response file
The db2setup command starts the DB2 Launchpad, a graphical tool that configures and organizes the DB2 installation. It lays down the DB2 filesets, creates and configures DB2 instances, users and groups, communications, the administration database used by the DB2 Tools, and sets up notification processes. The DB2 Launchpad also allows you to create a response file for replicating a particular setup to other systems.
Using db2setup is the best method for less experienced users, because most of the configuration is automatically performed during the installation. As mentioned previously, you require an X Window System capable of rendering a graphical user interface to use db2setup successfully.
The db2_install command script installs all DB2 packages on your Linux system. This method is reliable and commonly used by expert users for installing DB2 on larger, more complex systems. However, tasks such as setting up users and groups, creating instances, tools catalog database creation, and notification setup need to be performed manually after the installation is completed.
One limitation to db2_install is that it only installs user assistance (like help, messages, and tool interfaces) in English, whereas db2setup supports the installation of additional languages. Also, a db2_install installation can take longer (because of the higher number of manual configuration tasks); it requires a higher level of knowledge and skill, and it cannot be used to create response files.
A response file can be created using the DB2 Setup Wizard or by editing an existing DB2 response (.rsp) file. It allows you to install DB2 across multiple machines with consistent installation and configuration settings. A response file installation is fast, because it bypasses the graphical wizard configuration. Another advantage of using a response file instead of the db2_install command is that it creates a Database Administration Server (DAS) on each machine, while with db2_install the DAS must be created manually after installation.
There is a sample response file (db2exp.rsp) included on the installation image that can be modified and used to install DB2, configure users, create instances, set up notification, create the tools catalog, and configure a large number of database management parameters. This is the quickest installation method if you already have all the information you need. Unlike db2setup, the response file installation is not interactive, and it takes longer to prepare the response file initially.
DB2 requires user IDs and groups for database authentication. This section discusses these IDs and groups and how to create them.
DB2 requires a minimum of three users and groups: an instance owner, a fenced user, and the Database Administration Server (DAS) user. You may use the default names provided by the setup utilities, or specify your own user and group names. For example, consider the following default user IDs and group names produced by the DB2 Setup Launchpad:
Table 3. Default user IDs and group names
Required user |
User name |
Group name |
Description |
---|---|---|---|
Instance owner | db2inst1 | db2grp1 | Administers a DB2 instance |
Fenced user | db2fenc1 | db2fgrp1 | Responsible for executing "fenced" user defined functions, such as JDFs and stored procedures. |
DAS user | dasusr1 | dasadm1 | Administers the DB2 Administration Server |
You must have root authority to create users and groups. There are three ways to create a DB2 user ID:
DB2 Launchpad: the DB2 Launchpad installation creates all of the required users and groups for you during installation. The default users and groups that get created are displayed in the table above. This method also gives you the option to specify your own user and group names.
Response file: Users can also be created during a response file installation if you specify user and group information in the response file. For example, consider the following entries in a response file that create the three required users and groups for DB2:
* DAS user DAS_USERNAME = dasusr1 DAS_GROUP_NAME = dasadm1 DAS_HOME_DIRECTORY = /home/dasusr1 DAS_PASSWORD = ****** * Instance-owning user inst1.NAME = db2inst1 inst1.GROUP_NAME = db2grp1 inst1.HOME_DIRECTORY = /db2home/db2inst1 inst1.PASSWORD = ****** inst1.AUTOSTART = YES inst1.AUTHENTICATION = SERVER inst1.SVCENAME = db2c_db2inst1 inst1.PORT_NUMBER = 50001 inst1.FCM_PORT_NUMBER = 60000 inst1.MAX_LOGICAL_NODES = 4 * Fenced user nst1.FENCED_USERNAME = db2fenc1 inst1.FENCED_GROUP_NAME = db2fgrp1 inst1.FENCED_HOME_DIRECTORY = /db2home/db2fenc1 inst1.FENCED_PASSWORD = ****** |
Manually using command line. To use this method, follow these steps:
Log on to your machine as root.
Create groups for the instance owner, the fenced user and the DAS user by using these commands:
groupadd db2grp1 groupadd db2fgrp1 groupadd dasadm1 |
Create a user that belongs to each group and specify the home directory. For example, you can choose to place all home directories in /db2home by entering these commands:
useradd -g db2grp1 -m -d /db2home/db2inst1 db2inst1 -p password1 useradd -g db2fgrp1 -m -d /db2home/db2fenc1 db2fenc1 -p password2 useradd -g dasadm1 -m -d /db2home/dasusr1 dasusr1 -p password3 |
To enable existing system users to act as DB2 instance administrators, you must make a few modifications to the existing user accounts:
Add your user to the db2grp1 group. The SYSADM_GROUP database manager configuration parameter controls who has that level of access for all databases in that instance. You can determine what group is set as the SYSADM group by entering:
db2 get dbm cfg | grep SYSADM_GROUP |
By default, DB2 sets this as the db2grp1 group. To add the user to the SYSADM group, modify the /etc/groups file (as root), adding the user account ID to the line for the DB2 system admin group. For example:
db2grp1:x:102:jackc,ellenp,frankj |
Update the user's profile by adding the following lines to the .bashrc file in the home directory
# The following three lines have been added by the DB2 SYSADM. if [ -f /home/frankj/sqllib/db2profile ]; then . /home/frankj/sqllib/db2profile fi |
After installation, if you wish to grant or revoke access to databases (or other objects), use the "User and Groups" section of the Control Center or the GRANT and REVOKE SQL statements. If you want to see an example, by default the SAMPLE database grants a number of privileges to "PUBLIC".