DB2 Database:: Installation

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

DB2 Database:

The goal here will be to install:

 DB2 Database Admin Client


 UDB (Universal DataBase) Enterprise Edition
 Application Development Client (for writing your own applications)

and the sample database. The product "Connect Enterprise" will not be
installed for this exapmle. (It enables connectivity with mainframe services)

Installation:

1. Check configuration:
o Default language: echo $LANG 
For me this returned: en_US
o Check if reguired packages are installed: rpm -e pdksh compat-libs
ncurses4
The package pdksh ensures shell compatability with

commercial ATT based Unix sytems.
 The package compat-libs is for Red Hat 7.x+ systems to
have Red Hat 6.x compatability.
 Package ncurses4 provides terminal drivers and cursor
control mechanism.
2. Mount the CD (Disk 1 of 2): mount -t iso9660 -o ro /dev/cdrom
/mnt/cdrom 
[Potential Pitfall]: At first I was lazy and issued the command: mount
/mnt/cdrom which picks up system defaults and works for viewing CD
contents. The problem was that this mounts the CD with privileges
which allow for read only and does NOT allow one to execute scripts on
the CD. Use the above (complete) command which will allow for the
execution of scripts on the CD.
3. Install DB2: (as root)
o cd /mnt/cdrom/db72pf5u/
o ./db2setup

+----------------------------- DB2 Setup Utility ------------------------------+


| |
| Select Install to select products and their components to install, or |
| select Create to create the DB2 services. |
| |
| |
| To select products and their components, select [ Install... ] |
| Install. |
| |
| |
| To create a DB2 Instance, an Administration Server, [ Create... ] |
| or a Data Links Manager Administrator select Create. |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| [ Close ] [ Help ] |
+------------------------------------------------------------------------------+

o
Use the down arrow or tab key to migrate the menu. First select
the "Install..." option to select the products to install. Next select
the "Create..." option to create a DB2 Instance.
o After selecting the "Install..." option you will be presented with the
following panel:

+------------------------------- Install DB2 V7 -------------------------------+


| |
| Select the products you are licensed to install. Your Proof of |
| Entitlement and License Information booklet identify the products for |
| which you are licensed. |
| |
| To see the preselected components or customize the selection, select |
| Customize for the product. |
| :*: DB2 Administration Client [ Customize... ] |
| :*: DB2 UDB Enterprise Edition [ Customize... ] |
| [ ] DB2 Connect Enterprise Edition : Customize... : |
| :*: DB2 Application Development Client [ Customize... ] |
| |
| To choose a language for the following components, select Customize for |
| the product. |
| DB2 Product Messages [ Customize... ] |
| DB2 Product Library [ Customize... ] |
| |
| |
| |
| |
| [ OK ] [ Cancel ] [ Help ] |
+------------------------------------------------------------------------------+

o
Use the arrow (or tab) key to highlight a product selection. Use
the space bar to toggle selection between [ ] and [*]. After the
product has been selected, choose "Customize..." to add features.
 DB2 Administration Client
 :*: Java Support
 :*: Control Center
 DB2 UDB Enterprise Edition
 :*: Java Support
 :*: Replication
 :*: Local Warehouse Control Database
 :*: Distributed Join for DB2 Data Sources
 :*: Getting Started
 DB2 Application Development Client
 :*: Java Support
 :*: Control Center
 :*: DB2 Sample Applications
 :*: Create Links for DB2 Libraries
 DB2 Product Library (by default no language is selected. Select
one!)
 Optional: DB2 Product Library (HTML): 
:*: en_US [ ] fr_FR [ ] de_DE

Approve it by selecting OK.

Next create a DB2 instance. The default will be db2inst1. A Linux


user and home directory of the same name will be generated. You
will be prompted for a password. I advise selecting "[Properties...]"
to "Create a sample Database for the DB2 Instance".

+----------------------------- DB2 Setup Utility ------------------------------+


| |
| +-- Status Report -----------------------------------------------------+ |
| | | |
| | | |
| | The log file can be found in /tmp/db2setup.log. | |
| | | |
| | | |
| | Installation | |
| | ------------ | |
| | | |
| | DB2 Client SUCCESS | |
...
..

The DB2 installation is complete.

What just happened?:


The installation created and started IBM DB2 database. The process will be
running at this point. The following changes are made:

 Three users (and home directories) are created:


o db2as
o db2fenc1
o db2inst1
 Additions to the file: /etc/services
db2cdb2inst1 50000/tcp # Connection port for DB2 instance db2inst1
db2idb2inst1 50001/tcp # Interrupt port for DB2 instance db2inst1

 Additions to the end of system init file: /etc/inittab 


Statement added to start DB2 upon system boot. 
Database start script added: /etc/rc.db2
 DB2 database executables, libraries and support files: /usr/IBMdb2/V7.1/
 The database instance is held in /home/Instance-name/...
 Support files: /var/db2/v71/default.env and profiles.reg
 Documentation: (local files which can be accessed after installation from
CD)
o /usr/IBMdb2/V7.1/doc/en_US/html/index.htm
o /usr/IBMdb2/V7.1/Readme/en_US/Release.Notes

Environment variables as configured by DB2 install program: (logged in as


user db2inst1) 

Environment
Value
Variable
DB2DIR /usr/IBMdb2/V7.1
DB2INSTANCE db2inst1
ISNTHOME
LD_LIBRARY_P :/home/db2inst1/sqllib/lib
ATH
LIBPATH :/home/db2inst1/sqllib/lib
/
home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/functi
CLASSPATH on: 
/home/db2inst1/sqllib/java12/db2java.zip:/home/db2inst1/sqllib/
java/runtime.zip:.
$PATH:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm: 
PATH /home/db2inst1/sqllib/misc:/home/db2inst1/bin
Test the database:

 Log in as user db2inst1 
(i.e.: su - db2inst1)
 Issue the command: db2
 This will put you into the db2 environment and at the db2 command
prompt.
db2 => connect to sample
db2 => select * from employee
db2 => quit

Manage the database:

Commands used to manage the database: (login as user db2as)

 Start DB2: db2start 
By default the installation will start the database and configure the
system to start DB2 each time the system boots.
 List database instances: db2ilist
 List database release levels: db2level
 Stop DB2: db2stop

As user db2inst1:

 List Database Manager Configuration: db2 get dbm cfg


 List System Database Directory: db2 list db directory
 Generate sample database: db2sampl

Notes:

 The DB2 database will use TCP port 523.


 DB2 License manager (execute as root): /usr/IBMdb2/V7.1/adm/db2licm 
Functionality available in Control Center (db2cc).

DB2 GUI management tool db2cc:

In order to use DB2 GUI management tools one must install the IBM
Java run time environment. Login as DB2 administrative
usersdb2as or db2inst1 and run the command db2cc (DB2 Control
Center). It is important to add a JAVA_HOME statement to the environment
file: /home/db2as/.bashrc or for user db2inst1. Help and documentation is
also available from this panel or by initiating the
commanddb2ic (Information Center).

WebSphere Aplication Server:

Installation:

1. Mount the CD (Disk 1 of 2): mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom


2. Create install directory:

cd /tmp 
mkdir ws 
cd ws 
cp /mnt/cdrom/wasi401u/wasi401u.zip . 
unzip wasi401u.zip 
cd linux 
./install.sh

Note:

o This installation will install the HTTPD web server and the
WebSphere applications server. IBM uses it's own installation of
Apache and installs the appropriate modules. (I installed all
modules available.)
o The "IBM HTTP Server httpd.conf" configuration file requested
during installation is /opt/IBMHTTPServer/conf/httpd.conf 
The Apache httpd.conf: /etc/httpd/conf/httpd.conf 
(This original default apache installation was not used in this
tutorial.) 
This will add the statements:
...
Alias /WSsamples /opt/WebSphere/AppServer/WSsamples
...
LoadModule app_server_http_module
/opt/WebSphere/AppServer/bin/mod_app_server_http.so
WebSpherePluginConfig /opt/WebSphere/AppServer/config/plugin-
cfg.xml
AddModule mod_app_server_http.c

o The installation program will start the web server.


o [Potential Pitfall]: The installer launches a dialog box with the
message "The installer was not able to determine that you have a
supported Linux distribution." I ignored this message as it
probably was unfamiliar with Red Hat version 7.3. It was probably
expecting version 7.1.
o Samples/examples will also be installed at this time.
3. [Potential Pitfall]: The installation program fails to start the admin server.
Start manually: /opt/IBMHTTPServer/bin/adminctl start 
Conversely use the argument stop to stop the server or restart to restart
after a configuration change. Note:
o The admin web server operates on port 8008.
o The admin web server config
file: /opt/IBMHTTPServer/conf/admin.conf
4. Note: While the installation will start the web server, a system reboot will
not. One may start the web server manually if
necessary:/opt/IBMHTTPServer/bin/apachectl start
5. Start the Netscape browser (I used 4.79). Java MUST be enabled. (Edit
+ Preferences + Advanced + "Enable Java") Enter the
URLhttp://localhost/ and select "Configure server". (The password was
assigned during installation - remember it!) Next select from the admin
menu on the left hand side: "Basic Settings" (select arrow) + "Core
Settings". Set basic items like "Server name", etc. The items which can
be configured here can also be configured in the httpd.conf file by a
knowledgeable admin. (restart after editing.)
6. The final step for the installer is to launch the WebSphere Application
Server "First Step" panel. This may be launched manually any time later
on by using the command: /opt/WebSphere/AppServer/bin/firststeps.sh 
This "First Step" panel presents one with the options to:
o Learn about WebSphere Application Server 
Browser link: http://www-
4.ibm.com/software/webservers/appserv/infocenter.html
o Start the WebSphere server. 
May be started using "First Step" panel or use the
command: /opt/WebSphere/AppServer/bin/startServer.sh
o Run WebSphere Samples. 
Browser link: http://localhost/WSsamples/index.html
o Launch Administrative Console. 
Browser link: http://localhost:9090/admin (I used a null password) 
(Config file: /opt/WebSphere/AppServer/config/server-cfg.xml) 
Note: It only seemed to work with the node name of "localhost" as
I was not running a DNS server to resolve the name of my
computer.
o Launch Application Assembly Tool. 
Command: /opt2/WebSphere/AppServer/bin/assembly.sh
o Stop the WebSphere server. 
May be stopped using panel or use the
command: /opt/WebSphere/AppServer/bin/stopServer.sh

Notes:

 WebSphere uses the Lutris Technologies Enhydra server.


 Ports used: 900, 9000, 9080
 App server uses JVM in JAVA_HOME /opt2/WebSphere/AppServer/java

Web server plug-in verification/information:

 Show Servlet Request/Client


configuration: http://localhost:9080/servlet/snoop
 Show WebSphere Web Container
configuration: http://localhost:9080/webapp/examples/showCfg

Configure/Run Pet store examples:

 As root, add user: 


adduser wsdemo 
passwd wsdemo1
 Configure database: (as user db2as) 
Before you run the WebSphere Samples, execute the following
script as user db2as to load the DB2
database:/opt/WebSphere/AppServer/bin/DB2createSampleDB.sh
db2as You will be prompted for the password for the user db2as.
 As user db2as, issue command: db2set DB2COMM=tcpip
 Run Pet store example: http://localhost/estore

Instructions and more examples: http://localhost/WSsamples/index.html

Post install:

 The user db2inst1 is generated as a user who may access the instance


of the same name. Add to the user profile:/home/db2inst1/.bashrc
if [ -f /home/db2inst1/sqllib/java12/usejdbc2 ]; then
. /home/db2inst1/sqllib/java12/usejdbc2
fi
Also for users: db2inst1, db2fenc1, db2as

You might also like