Install DB2 in RedHatEnterpriseLinux5.4 [graphic interface]

Source: Internet
Author: User
Tags db2 client
You can use the graphical interface or manually install the tool. First, we will introduce the simplest installation method. 1. Download DB29.7expressC from the IBM Website: file name db2exc_9720.lnx_x86.tar.gz ,. 3. Enter the relevant directory and run the Installation File

You can use the graphical interface or manually install the tool. First, we will introduce the simplest installation method.

1. Download DB2 9.7 express C from the IBM Website: file name db2exc_9720.lnx_x86.tar.gz ,.

2. decompress and unpackage in LINUX
# Gzip-d db2exc_9720.lnx_x86.tar.gz

# Tar-xvf db2exc_971_LNX_x86.tar

3. Go to the relevant directory and run the installation file.
# Xhost +
# Cd expc
#./Db2setup
Allow all users to use the xwindows interface first.
Find the db2setup file in the current directory and execute it.
If the permission is insufficient, run chmod + x db2setup first.

4. Install the SDK Based on the graphic interface
You can select the installation location or content.
In the process, you need to set the names and passwords of the three DB2 users and record them. Note that DB2 does not have its own user management system, so these users are actually LINUX users.
Complete the installation.

5. Verify that the installation is successful.
[Root@www.linuxidc.com expc] # su-db2inst1
Db2inst1@www.linuxidc.com ~ $ Db2 create database test
DB20000I The create database command completed successfully.
Db2inst1@www.linuxidc.com ~ $
Db2inst1 is one of the three users created during the installation process, and is the administrator user of the instance.
If the database is successfully created, the installation is successful.

For more initial configurations, see Manual installation of DB2.

######################################## ################

Manual installation steps for DB2 for linux

Step 1 download db2 data packets
The latest version is 9.7. Download the free Express C version from the IBM website.
Db2exc_971_LNX_x86.tar.gz and the language package db2exc_nlpack_971_lnx_x86.tar.gz (optional ).

Step 2 upload the Installation File
Upload the downloaded package ftp to the LINUX machine to be installed

Step 3: Release db2exc_9720.lnx_x86.tar.gz
# Gzip-d db2exc_9720.lnx_x86.tar.gz
# Tar-xvf db2exc_971_LNX_x86.tar

Step 4 install
After the package is decompressed, the directory named expc is displayed. Find the db2_install and db2setup files. The former is manual installation, and the latter is graphical interface installation.
# Cd expc
#./Db2_install
After setting the installation directory, wait patiently for the installation task to complete.
The default installation path is/opt/ibm/db2/V9.7, which can be checked.


Step 5 register license
This step is not required for this installation.
For enterprise edition and other versions, you must register a license to use it.
For V8.1 ESE, the license registration file is:/opt/DB2_V81_PE_LNX_32_NLV/db2/license/db2ese. lic. Otherwise, you need to find db2ese. lic by yourself,
Based on actual conditions
#/Opt/IBM/db2/V8.1/adm/db2licm-a/opt/334_ESE_LNX26_32_NLV/db2/license/db2ese. lic
If the prompt is:
DBI1402I License added successfully.
DBI1426I This product is now licensed for use as specified in
The License Acceptance and License Information
Documents pertaining to the licensed copy of this
Product. USE OF THE PRODUCT CONSTITUTES ACCEPTANCE
THE TERMS OF THE IBM LICENSE ACCEPTANCE AND LICENSE
Information documents, LOCATED IN THE FOLLOWING
DIRECTORY:/opt/IBM/db2/V8.1/license/zh_CN.utf8
Indicates registration successful

Step 6: create user groups and users required for running DB2
Note that DB2 does not have an independent user management system. You must use OS users to provide security authentication. Therefore, you must create LINUX users and groups here.
# Groupadd-g 901 db2grp
# Groupadd-g 902 db2fgrp
# Groupadd-g 903 db2agrp # useradd-g db2grp-u 801-d/home/db2inst1-m-s/bin/sh db2inst1
# Useradd-g db2fgrp-u 802-d/home/db2fenc-m-s/bin/sh db2fenc
# Useradd-g db2agrp-u 803-d/home/db2das-m-s/bin/sh db2das
The Default User Name here is:
DAS user dasusr1 group name: dasadm1
User db2inst1 group name for instance management: db2iadm1
Protected user db2fenc1 group name: db2fadm1
However, DB2 users can name it at will.

Step 7 Add a password
# Passwd db2inst1
Changing password for db2inst1.
New password: [enter a New password]
Re-enter new password: [enter the new password again]
Password changed
After the user is created, run the following command to check whether the user group and user are created successfully.
# More/etc/group | grep db2
# More/etc/passwd | grep db2
If the result contains the three users and groups, the creation is successful. The correct result should be:
# More/etc/group | grep db2
Dialout: x: 16: db2inst1, db2fenc, db2das
Video: x: 33: db2inst1, db2fenc, db2das
Db2grp :! : 901:
Db2fgrp :! : 902:
Db2agrp :! : 903:
# More/etc/passwd | grep db2
Db2inst1: x: 801: 901:/home/db2inst1:/bin/sh
Db2fenc: x: 802: 902:/home/db2fenc:/bin/sh
Db2das: x: 803: 903:/home/db2das:/bin/sh


Step 8: Create an instance.
B1. go to the/opt/ibm/db2/V9.7/instance directory.
# Cd/opt/ibm/db2/V9.7/instance
2. Run the following command:
#./Dascrt-u db2das
#./Db2icrt-u db2inst1 db2inst1
Here, dascrt creates the DB2 adminstration server. Each server has only one such server, which is required for DB2 management (such as the Operation Control Center) and specifies that the management user is db2das.
Db2icrt creates an instance. Its name is generally the same as that of the Management User Name. Here it is db2inst1.
3 Start DB2
Switch to the db2das user and run db2admin to start the DB2 management server.
$ Db2admin start
Switch to the db2inst1 user and run db2start to start the database instance.
$ Db2start


Step 9 configure DB2
1. Set DB2 to start automatically.
Run the following command as the root user:
# Cd/opt/ibm/db2/V9.7/instance
#./Db2iauto-on db2inst1
Set to automatically start db2inst1 when LINUX is started.

2. Configure the network
Switch to the db2inst1 user.
# Su-db2inst1
Modify the service port of DB2 to 50000. The default port is 50000.
$ Db2 update dbm cfg using SVCENAME 50000
DB20000I The update database manager configuration command completed
Successfully.
Modify the DB2 connection mode to TCPIP, and then access the database on the DB2 server through JDBC, ODBC, and other machines installed on the DB2 client to access the database.
$ Db2set DB2COMM = TCPIP
So far, the installation process is complete.

Step 10 create and access the database, install and verify
1. Start and close a database instance
Before doing anything, start the database instance
Switch to the db2inst1 user and run db2start to start the database instance.
$ Db2start
SQL1063N DB2START processing was successful.
If necessary, run the following command to close the database instance.
First, force close all applications on the instance under the user db2inst1.
$ Db2 force applications all
Shut down the database instance.
$ Db2stop
SQL1064N DB2STOP processing was successful.
2. Create a database
$ Su-db2ins1
$ Db2 create database test1
DB20000I The create database command completed successfully.
The database is created successfully.
3. Remote database access
The author installed RHEL5.4 and DB2 on the vmwarevm and installed DB2 ESE for windows V9.7 on the host. After experiment configuration, the host can access the DB2 database on the VM. Run db2cmd on the host and then run:

C: \ Documents ents and Settings \ Administrator> db2 catalog tcpip node www.linuxidc.com remote 192.
168.211.132 server 50000
The DB20000I catalog tcpip node command is successfully completed.
DB21056W does not take effect until the directory cache is refreshed.

C: \ Documents ents and Settings \ Administrator> db2 catalog database test1 as test_1
Node www.linuxidc.com
The DB20000I catalog database Command is successfully completed.
DB21056W does not take effect until the directory cache is refreshed.

C: \ Documents ents and Settings \ Administrator> db2
? Copyright IBM Corporation 1993,2007
DB2 client 9.7.0 command line Processor

You can issue Database Manager commands and SQL statements from a command prompt. For example:
Db2 => connect to sample
Db2 => bind sample. bnd

For general help, enter :?.
For Command help, enter :? Command, where command can be
The first few keywords of the Database Manager Command. For example:
? Catalog database is used to help with the catalog database Command
? CATALOG is used to help all CATALOG commands.

To exit the db2 interaction mode, enter
QUIT. In non-interactive mode, all commands must be prefixed with "db2.
To LIST the settings of the current command options, enter list command options.

For more help, see Online Reference Manual.

Db2 =>! Db2set
DB2INSTOWNER = WWW-A448048D8D7
DB2PORTRANGE = 60000: 60003
DB2INSTPROF = C: \ DOCUMENTS ents and settings \ all users \ application data \ IBM \ DB2 \ DB2COPY
1
DB2COMM = TCPIP
Db2 => connect to test_1 user db2inst1
Enter the current password of db2inst1:

Database connection information

Database Server = DB2/LINUX 9.7.1
SQL authorization id = DB2INST1
Local Database alias = TEST_1

Db2 =>
######################################## #############

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.