Pages

Friday, May 27, 2011

DB2 Installation steps

4. Prerequisites

Prerequisites are the hardware and software elements needed on your system before you can install and use DB2 Express-C 9. This section covers:

  • Hardware requirements:
    • Supported processors
    • Disk space requirements
    • Memory requirements
  • Software requirements:
    • Linux distributions
    • Kernel levels and libraries requirements
    • Additional software requirements


4.1. Hardware requirements

4.1.1. Supported processor architectures


  • x86 (32-bit processor)
  • x86–64 (64-bit processor)
  • POWER™ (any iSeries™ or pSeries® that supports Linux)

4.1.2. Disk space requirements

Take into account the disk space requirements before you install and configure DB2 on your distribution:
Table 1. Disk space requirements
Install type Description Required disk space
Typical DB2 is installed with most features and functionality, including graphical tools such as the Control Center. 460 to 560 MB
Compact DB2 is installed with basic features and functionality, but without the graphical tools. 380 to 460 MB
Custom This option allows you to select the features and functionality that you want to install. 320 to 820 MB

It's important to allocate enough disk space for the software, along with the product documentation (if desired) and the databases you create.
In DB2 9, product documentation is accessed through the DB2 Information Center, either via the web, or as a local system installation. To install this locally requires at least 100 MB when installing the core English language files. Additional space is required for other additional languages. If disk space is an issue, you can configure DB2 to access the Information Center from the Web. More detail about this is provided in Installing the DB2 Information Center.

4.1.3. Memory requirements

We recommend that you should allocate a minimum of 512 MB of RAM for DB2 Express-C 9, and additional memory should be allocated for other software and communication processes. When determining memory requirements, consider the following points:

  • Your SWAP space should be at least twice as much as your RAM.
  • Additional memory should be allocated for any non-DB2 software that may be running on your system.
  • Additional memory is necessary to support database clients and database activity.
  • These memory requirements will be affected by the size and complexity of your database system, as well as specific performance requirements.
  • The maximum RAM allowed for a DB2 Express-C installation is 4 GB.

4.2. Software requirements

4.2.1. Distribution levels that are supported by DB2 Express-C 9

For a list of all the distributions that are officially supported, as well as the latest information about kernels, libraries, integrated cluster environments, and papers, visit the DB2 for Linux validation web site listed in Resources.

4.2.2. Additional software requirements

Depending on your DB2 requirements, you may be required to install additional software packages for DB2 to function properly. Make sure that these software packages are installed prior to using DB2.

  • X Window System software, capable of rendering a graphical window manager (KDE, Gnome, etc.). You will need this if you want to use the DB2 graphical installer, or any of the DB2 graphical tools.
  • A web browser, to view topics in the DB2 Information Center.
  • If you are using NIS or NIS+ for security authentication on your system, you must create DB2 user accounts before installing DB2.
  • Additional packages, as outlined in the following table:
    Table 2. Package requirements
    Package name RPM name Description
    compat-libstdc++ compat-libstdc++ Required by 64-bit architectures only. Required for backwards compatibility with standard C++ libraries used by DB2.
    nfs-utils nfs-utils (version 1.0 or later) Network File System support package. It allows access for local files to remote machines. Required for systems utilizing NFS mounted drives.
    To check whether you have these packages installed, use the rpm -q commands:

    rpm -qa compat-libstdc++*

    To install these packages on Red Hat Linux, use the Red Hat Linux installation CDs and the rpm command, or the up2date utility. For example, to install the compat-libstdc++ package from the Red Hat Linux CD, mount the Red Hat Linux CD #4, and enter this command as root:

    rpm -ivh /mnt/cdrom/RedHat/RPMS/compat-libstdc++-296-2.96-132.7.2.i386.rpm
    To install using the up2date package, run this command as root:

    up2date compat-libstdc++

    To install these packages on SUSE Linux, you can also use rpm or use the handy YaST (Yet another Setup Tool) utility. For example, to install nfs-utils on SLES 9 using YaST:

    1. Log on as root
    2. From the YaST Control Center, select Software -> Software Management, then use the search "nfs-utils" to find the appropriate packages.

      5. Installation considerations and planning

      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:

      • Installation choices:
        • db2setupinstallation
        • db2_installinstallation
        • DB2 response file installation
      • User and group setup:
        • User and group requirements
        • Creating users

      5.1. Installation methods

      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
      Each method has its own advantages and disadvantages. The choice of method depends on your level of expertise and type of environment, but in general, if a graphical interface is available, using db2setup is recommended for ease of installation.

      5.1.1. db2setup installation

      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.

      5.1.2. db2_install installation

      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.

      5.1.3. Response file installation

      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.

      5.2. User and group setup

      DB2 requires user IDs and groups for database authentication. This section discusses these IDs and groups and how to create them.

      5.2.1. User and group requirements

      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

      5.2.2. Creating users

      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:

        1. Log on to your machine as root.
        2. Create groups for the instance owner, the fenced user and the DAS user by using these commands:

          groupadd db2grp1
          groupadd db2fgrp1
          groupadd dasadm1
          Linux will create the groups using the first available group ID (GID) numbers available. You can specify GID numbers if you prefer.
        3. 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
                              

      5.2.3. Adding existing users as DB2 users

      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".

      . Installing DB2 Express-C

      This chapter covers a typical setup scenario for installing DB2 Express-C on a 32-bit Linux system, using the db2setup installation method.

      6.1. db2setup installation

      6.1.1. Prerequisites



      • Ensure that your system meets the software, memory, and disk requirements outlined in Section 5.
      • You require root authority to perform the installation.
      • The DB2 Setup Launchpad is a graphical installer. You must have X Window System software capable of rendering a graphical user interface for the DB2 Setup Launchpad to run on your machine.

      6.1.2. Procedure

      To install DB2 Express-C 9:

      1. Log on to the system as a user with root authority.
      2. If you are installing from a CD or DVD, enter the command to mount the DB2 installation media. For example,

        mount /media/cdrom
        If you are using a downloaded tar.gz file, extract the contents of this archive to a location on your harddrive. For example, presuming the tar.gz file was downloaded to the /tmp directory:

        cd /tmp
        tar zxf db2exc_912_LNX_x86.tar.gz

      3. Change to the install directory. For the CD/DVD install:

        cd /media/cdrom/exp/disk1
        For the downloaded and extracted tar.gz file:

        cd /tmp/exp/disk1

      4. Run the db2setup command.

        ./db2setup

      5. When the IBM DB2 Setup Launchpad opens, select "Install a Product".
      6. Select the "Install New" button in the main window.
      7. When the Welcome to the DB2 Setup wizard window appears, click "Next".
      8. Read the license agreement and select the "Accept" button if you accept the terms (the "Decline" button is selected by default). Click "Next".
      9. On the Select the installation typewindow, select the type of installation you want to perform. You have three installation options:
        • Typical: 460–560 MB. This option installs and configures most of the DB2 components, using a typical configuration with default values. This option includes all of the core features, along with ODBC support, and commonly used tools such as the Control Center. You can select the "View Features" button to see what components get installed with this option.
        • Compact: 380–460 MB. This option installs and configures only the basic DB2 components, with minimal configuration performed on your computer. With this option you get the base server and client support, along with Java and SQL procedure support. Again, you can click the "View Features" button for more information.
        • Custom: 320–820 MB. This option allows you to install only those components that you select; and to create and customize a basic DB2 instance.
        Make your choice and click "Next". (The remainder of these instructions are based on the Custom installation option).
      10. On the Select the installation action window, choose the "Install DB2 Express on this computer" radio button. You can also choose to save your installations settings in a response file by selecting "Save your settings in a response file". You should choose this option if you plan to install DB2, with these same settings, on other computers in your environment.
      11. Choose the DB2 elements you want on the Select the features to install window. You can preview each component by selecting it and reading the corresponding description in the Description section.
        You can also choose where to install the DB2 program files. By default for a first time installation, this location is /opt/ibm/db2/V9.1/ Once you have decided what features you want to install and the destination, click "Next".
      12. Select what languages you want installed for the messages and user interface on your computer in the Languages window. English is always installed, regardless of other language choices. Click "Next".
      13. In the Specify the location of the DB2 Information Center window, select how you want to access the DB2 Information Center. The DB2 Information Center contains documentation for DB2 and other related DB2 products. The "On the IBM Web site" button is selected by default. By choosing this option, DB2 is configured to access documentation on the Web using your browser. If you have a copy of the DB2 Information Center installed elsewhere on an intranet server, you can choose the "On the following intranet server" button. Specify the values in the Host name and Port number text fields (the default value for the port number is 51000). Click the "Help" button for more information, otherwise click "Next".
      14. Fill out the information for the user that will administer the DB2 Administration Server in the Set user information for the DB2 Administration Server window. Select either the "New user" button, or the "Existing user" button. The Password and Confirm password text boxes are outlined in red indicating required fields that must be filled in for the installation to continue. If you choose to create a new user, a user account will be created (including a home directory) on your Linux system. Click "Next".
      15. If you want to create a new basic DB2 instance to store your database, then select the "Create a DB2 instance" button on the Set up a DB2 instance window. Otherwise, select the "Defer this task until after installation is complete" button. If you select this second option, you will need to create a new instance after the installation by using the db2icrt command. Click "Help" for more information, otherwise click "Next".
      16. If you create a new instance, fill out the information for the DB2 instance owner on the Set user information for the DB2 instance owner window. Select either the "New user" button, or the "Existing user" button. The Password and Confirm password text boxes are outlined in red indicating required fields that must be filled in for the installation to continue. Again, if you choose to create a new user, a user account will be created (including a home directory) on your Linux system. Click "Next".
      17. Fill out the information for the DB2 fenced user on the Set user information for the fenced user window. Select either the "New user" button, or the "Existing user" button. The Password and Confirm password text boxes are outlined in red indicating required fields that must be filled in for the installation to continue. For more information on fenced users, and how fenced users relate to fenced and non-fenced user-defined functions (UDFs) and stored procedures, click "Help". Otherwise, click "Next" to continue.
      18. Configure the DB2 instance for TCP/IP communications on the Configure instance IP communication and startup window. You may either accept the default values found in the Service name and Port number fields, or select your own. If you want to configure the instance properties at a later time, select the "Do not configure at this time" button. This service name and port are added to the services file for the system, typically found in /etc/services.
        You can also choose whether to start up this instance at system startup. This is recommended if you are planning on running your system as a DB2 server. Click "Next".
      19. On the Prepare the DB2 tools catalog window, select the "Prepare the DB2 tools catalog" button if you want to use the Task Center or Task Scheduler. This option creates a local database that stores task metadata. If you do not have this task repository, the scheduler will not function. If you want to create a DB2 tools catalog after you finish the installation, select the "Do not prepare the DB2 tools catalog" button. You can create the DB2 tools catalog later manually by using the CREATE TOOLS CATALOG command. Click "Next".
        If you decide to create a DB2 tools catalog, you can specify which instance, database, and schema in which to store the DB2 tools catalog. The DB2 tools catalog will be placed in the home directory of the instance owner. Click "Next".
      20. Specify a notification mail server and contact list on the Set up notifications window. This allows DB2 to notify administrators if a database requires attention. Either create a new contact list that is stored locally, or use an existing global contact list that resides on a remote DB2 server. Use an available SMTP server that will accept an unauthenticated SMTP message for e-mail notifications. You may also choose to skip this step; DB2 will still record all administration notifications in the log files. Click "Next".
      21. If you specified a new local list for contacts in the previous step, then in the Specify a contact for health monitor notification, you can add a name and email address where DB2 Health Center messages will be sent for any health alerts from DB2 databases.
      22. On the Start copying files window, review the installation settings, and then click "Finish" to complete the installation. The Current settings panel provides a summary of your installation and configuration settings.
      While the files are being copied to your computer, you will see two status bars on the Installing DB2 Express window, one indicating the progress of each individual installation task, and one for the overall installation progress. When the installation is finished, the Setup Complete window indicates what, if any, post-installation steps need to be taken, along with a tab (labelled "Log File") that shows the log file report for the installation. Click "Finish" to close this window and the Setup Launchpad.

      7. Installing DB2 Express-C on Red Hat Enterprise Linux (RHEL) 4

      Before proceeding, please ensure that you have read Section 5 and Section 6.
      These installation notes are based on a single-partition installation using the 2.6.9-55.0.2 EL kernel.

      7.1. Installation notes

      The installation on Red Hat Enterprise Linux 4 completed successfully, with no problems getting the GUI installer working, and no errors during the install. This smooth installation isn't surprising, given that RHEL 4 is an officially supported platform for DB2.

      7.2. Post-installation notes

      Basic test results (see Section 21 for more details) were successful.
      However, I found that after a reboot, the DB2 instance was not being restarted automatically, so clients could not connect to the database. To correct this problem, execute this command as the instance owner:

      db2set DB2AUTOSTART=YES
      This will ensure that the DB2 instance is initialized and ready to receive incoming connections after a reboot (intentional or otherwise).
      Also, to allow DB2 access through the iptables-based firewall (which is enabled by default), it was necessary to modify the iptables firewall ruleset, which is kept in the /etc/sysconfig/iptables file. If you have enabled your firewall (using the iptables service), and you want to enable external connectivity to your DB2 server, you must open up TCP and UDP access to ports 523 and TCP access to any DB2 service ports. To make this work, add these rules to the iptablesfile (anywhere amongst the -j ACCEPT rules):

      -A RH-Firewall-1-INPUT -p udp -m udp --dport 523 -j ACCEPT
      -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 523 -j ACCEPT
      -A RH-Firewall-1-INPUT -p tcp -m tcp --dport 50000 -j ACCEPT
      These rules were added directly to the iptables file to ensure that they persist in case of a system reboot. Note that you will need to add another new TCP rule to allow firewall access if you create any additional instances later.
      You can use db2 get dbm cfg | grep SVCENAME to retrieve the service names and then check the /etc/services for the equivalent port values to open on your firewall.
      ----------------------------------------------------------------------------------------------

      Removing DB2 Express-C

      Uninstalling DB2 Express-C is a bit more detailed than the installation process. Unfortunately, at this time, there is no GUI-based uninstaller utility like there is for installation. Follow the steps below to completely remove the DB2 Express-C software from your system. Since the database files are kept in the home directory of the instance user, you can keep the database files by skipping the removal of the instance owner (the last step).

      1. Remove the Database Administration Server. Switch to the DAS owner (dasusr1 by default), either through the su - dasusr1 command or by logging in to the system directly as the DAS user, and issue the command db2admin stop. Then switch to the root user, and issue the /opt/ibm/db2/V9.1/instance/dasdrop command.
      2. Remove the DB2 instance(s). Switch to the instance owner (db2inst1 by default), either through the su - db2inst1 command or by logging in to the system directly as the instance user, and issue the command db2stop. Then, as root, remove the instance by issuing the /opt/ibm/db2/V9.1/instance/db2idrop db2_instance command, where db2_instance refers to the actual instance name you want to drop (for example, /opt/ibm/db2/V9.1/instance/db2idrop db2inst1). If you want to verify which instances are present on your system, run the /opt/ibm/db2/V9.1/instance/db2ilist command.
      3. Remove the software installation. As root, run the /opt/ibm/db2/V9.1/install/db2_deinstall -a command. This will remove the installation of DB2 from your system.
      4. If no longer need the DB2 database files (which are kept in the home directory of the instance owner), you can remove the users that were created during the installation of DB2 Express-C by entering these commands as root:

        userdel -r db2inst1
        userdel -r dasusr1
        userdel -r db2fenc1
        (If you created different user names during installation, substitute as necessary.)

        Thanks to : http://tldp.org/HOWTO/DB2-HOWTO/prerequisites.html
      Suggestions are always welcome...! Without signing also you can send your comments.

No comments: