1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
|
<html>
<head>
<title>SQL Relay - Getting Started With IBM DB2 - Installing DB2 Version 7.2</title>
<link rel="stylesheet" href="../../css/styles.css">
</head>
<body>
<span class="heading1">Installing IBM DB2 Version 7.2</span><br>
<br><br>
<span class="heading2">Install libncurses.so.4</span><br>
<p>DB2 7.2 requires libncurses.so.4. Many older distributions come with
libncurses.so.4. Many newer distributions come with libncurses.so.5 (or newer).
Some distributions come with both. If your distribution does NOT have
libncurses.so.4, create a symbolic link to the newer library as follows.</p>
<p>(These instructions assume that your system has ncurses version 5.2 and that
libncurses.so.5.2 resides in /usr/lib. If your system has a different version
of ncurses or if it resides somewhere else (for example, in /lib) then modify
the instructions accordingly)</p>
<blockquote>
<b>cd /usr/lib<br>
ln -s libncurses.so.5.2 libncurses.so.4</b>
</blockquote>
<span class="heading2">Install Compatibility Packages</span><br>
<p>DB2 V7.2 for Linux requires glibc 2.1. Many newer Linux distributions come with glibc 2.2. On these distributions it is necessary to install some
compatibility packages.</p>
<p>Distributions that come with glibc 2.1 include RedHat 6, Debian 2.2,
Mandrake 7 and Slackware 7. Newer distributions come with newer versions of
glibc.</p>
<p>RedHat provides compatability RPM's for RedHat 7 that can actually be used
on any Linux distribution. These RPM's can be downloaded from
<a href="http://rpmfind.net">rpmfind</a>. You'll need the following RPM's.
</p>
<ul>
<li><b>compat-glibc-6.2-2.1.3.2.i386.rpm</b> for RedHat Linux 7.3</li>
<li><b>compat-egcs-6.2-1.1.2.16.i386.rpm</b> for RedHat Linux 7.3</li>
<li><b>compat-libstdc++-6.2-2.9.0.16.i386.rpm</b> for RedHat Linux 7.3</li>
</ul>
<p>You can install the compatibility RPM's using <i>rpm -i</i>.</p>
<span class="heading2">DB2 Installation</span><br>
<p>IBM DB2 V7.2 is available from
<a href="http://www-3.ibm.com/software/data/db2/linux/">the IBM website</a> as
a tarball. Extracting the tarball using <i>tar xf</i> creates a directory
called 018_EEE_LNX_NLV. Change directories into that directory.</p>
<p>On Debian Linux and Slackware Linux, edit the db2_install script and
comment out the line:</p>
<blockquote>
<b>rpm -qa | grep rpm 1>/dev/null 2>/dev/null</b>
</blockquote>
<p>If you're installing on a computer that gets moved around a lot (such as a
laptop) and gets assigned more than 1 hostname, you should set the hostname
to localhost now using the following command:</p>
<blockquote>
<b>hostname localhost</b>
</blockquote>
<p>The installer will name the database after whatever hostname your computer
currently has. This will cause the database to be inaccessible when that
hostname doesn't resolve or resolves to a computer other than yours.</p>
<p>Run the db2_install script.</p>
<p>When prompted to specify a keyword, type DB2.EENT and press return.</p>
<p>When the script completes, run <i>rpm -qa</i> and verify that the following
RPM's were installed:</p>
<blockquote><b>
db2cnvc71-7.1.0-40<br>
db2gs71-7.1.0-40<br>
db2cucs71-7.1.0-40<br>
db2engn71-7.1.0-40<br>
db2cdrd71-7.1.0-40<br>
db2dj71-7.1.0-40<br>
db2pext71-7.1.0-40<br>
db2cliv71-7.1.0-40<br>
db2rte71-7.1.0-40<br>
db2wcc71-7.1.0-40<br>
db2hten71-7.1.0-40<br>
db2cnvk71-7.1.0-40<br>
db2cj71-7.1.0-40<br>
db2conn71-7.1.0-40<br>
db2smpl71-7.1.0-40<br>
db2xlic71-7.1.0-40<br>
db2cnvj71-7.1.0-40<br>
db2crte71-7.1.0-40<br>
db2cdb71-7.1.0-40<br>
db2das71-7.1.0-40<br>
db2cnvt71-7.1.0-40<br>
db2repl71-7.1.0-40<br>
db2adts71-7.1.0-40<br>
db2jdbc71-7.1.0-40<br>
db2adt71-7.1.0-40<br>
</b></blockquote>
<span class="heading2">Ignore the Misinformation</span><br>
<p>There are many, many instances where the DB2 Version 7.2 distribution
identifies itself as version 7.1 instead of 7.2. For example, the RPM's have a
7.1.0 version number. These clues might lead one to think that he or she has
accidentally installed version 7.1 instead of version 7.2, but this is not the
case.</p>
<span class="heading2">Install the Documentation</span><br>
<p>For version 7.2, once the RPM's are installed, you can install the
documentation by running <i>/usr/IBMdb2/V7.1/doc/db2insthtml en_US</i>.
To view the documentation, point your browser at
<a href="file://usr/IBMdb2/V7.1/doc/en_US/html">
/usr/IBMdb2/V7.1/doc/en_US/html</a>.</p>
<a name="odbc"></a>
<span class="heading2">Restore unixODBC if Necessary</span><br>
<p>The DB2 installation creates symbolic links from include files in
it's base directory to /usr/include. If you had a unixODBC-devel RPM
installed prior to installing DB2, the include files provided by the
unixODBC-devel RPM will have been overwritten by these symbolic links. You
should probably reinstall the unixODBC-devel RPM. SQL Relay looks in
the DB2 installation directory for DB2 includes, so not having them in
/usr/include won't hurt, but not having the proper unixODBC includes in
/usr/include will cause the ODBC database connection build to fail.</p>
<p>This should be enough you get you started. To set up more complex
configurations, consult the documentation that came with your DB2
distribution.</p>
<span class="heading2">Creating an Instance</span><br>
<p>IBM DB2 is installed under either /opt/IBMdb2/V7.1, /usr/IBMdb2/V7.1
That directory will be referred to as <i>BASE_DIR</i> in this document.</p>
<p>A DB2 installation consists of an administration server and one or more
instances. Each instance contains one or more databases. The administration
server coordinates the instances. The administration server is owned by an
OS-level user. Each instance is owned by a seperate OS-level user as well.</p>
<p>To create an instance and an administration server, run
<i>BASE_DIR/install/db2setup</i>, a text-based installation program.</p>
<blockquote>
Select <b>[ Create... ]</b><br>
Select <b>Create a DB2 Instance</b><br>
Accept the default user name (db2inst1).<br>
Accept the default UID.<br>
Accept the default group name (db2iadm1).<br>
Accept the default GID.<br>
Pick a password.<br>
Select <b>[ OK ]</b><br>
<br>
A screen for creating the Fenced User (the user that will run user defined
functions and stored procedures) will now appear.<br>
<br>
Accept the default user name (db2fenc1).<br>
Accept the default UID.<br>
Accept the default group name (db2fadm1).<br>
Accept the default GID.<br>
Pick a password.<br>
Select <b>[ OK ]</b> This will return you to <b>Create DB2 Services</b>
screen.<br>
<br>
Select <b>Create the Administration Server</b><br>
Accept the default user name (db2as).<br>
Accept the default UID.<br>
Accept the default group name (db2asgrp).<br>
Accept the default GID.<br>
Pick a password.<br>
Select <b>[ OK ]</b><br>
If you get a <b>DB2SYSTEM will be set to ...</b> dialog, select
<b>[ OK ]</b>.<br>
<br>
On the <b>Create DB2 Services</b> screen, select <b>[ OK ]</b><br>
Select <b>[ Continue ]</b><br>
Select <b>[ OK ]</b> in the <b>This is your last chance to stop</b>
dialog.<br>
<br>
Now the instance and administration server will be created.<br>
If all went well, you'll get a <b>Completed Sucessfully.</b> notice.<br>
To exit,<br>
Select <b>[ OK ]</b><br>
Select <b>[ OK ]</b><br>
Select <b>[ Close ]</b><br>
Select <b>[ OK ]</b>
</blockquote>
<p>Should you need to create additional DB2 instances, follow this procedure
again using a different user name and skipping the steps pertaining
to the Administration Server. The <i>BASE_DIR/instance/db2ilist</i>
command lists all of the DB2 instances on the local computer.</p>
<p>If you need to drop an instance, run
<i>BASE_DIR/instance/db2idrop instancename</i>, substituting the name of
the instance you want to drop for instancename.</p>
<p>The <i>BASE_DIR/instance/dasilist</i> command lists all of the DB2
administration servers on the local computer.</p>
<p>If you need to drop an administration server, run
<i>BASE_DIR/instance/dasidrop servername</i>, substituting the name of
the administration server you want to drop for servername.</p>
<span class="heading2">Enable Remote Access</span><br>
<p>By default, a DB2 instance only accept connections from clients running on
the local machine. To enable connections from clients running on a remote
machine over TCP, execute commands like the following. These commands set
up the <i>db2inst1</i> instance on port 50000.</p>
<blockquote>
log in as root<br>
view <i>/etc/services</i> and look for a line like:<br>
<blockquote><b>
db2cdb2inst1 50000/tcp # Connection port for DB2 instance db2inst1<br>
</b></blockquote>
if no such line exists, add it
<br>
log in as db2as<br>
run the following commands:<br>
<blockquote><b>
. /home/db2inst1/sqllib/db2profile<br>
db2 "update database manager configuration using svcename db2inst1"<br>
db2stop<br>
db2start<br>
</b></blockquote>
</blockquote>
<p>Now the <i>db2inst1</i> instance should be accessible to remote clients on
port 50000.</p>
<span class="heading2">Starting the Database at Boot Time</span><br>
<p>During the DB2 installation process, /etc/inittab is modified such that
the database will be started at boot time. However, if you would like to start
and stop the database at will, you can use the following script.</p>
<blockquote>
<PRE>
<FONT color=#0000ff>#!/bin/sh</FONT>
<B><FONT color=#a62828>case</FONT></B> "$1" <B><FONT color=#a62828>in</FONT></B>
start<B><FONT color=#a62828>)</FONT></B>
/usr/IBMdb2/V7.1/instance/db2istrt
<B><FONT color=#a62828>;;</FONT></B>
stop<B><FONT color=#a62828>)</FONT></B>
/usr/IBMdb2/V7.1/instance/db2ishut
<B><FONT color=#a62828>;;</FONT></B>
*<B><FONT color=#a62828>)</FONT></B>
<B><FONT color=#a62828>echo</FONT></B><FONT color=#ff00ff> $</FONT><B><FONT color=#a62828>"</FONT></B><FONT color=#ff00ff>Usage: </FONT><FONT color=#a620f7>$0</FONT><FONT color=#ff00ff> {start|stop}</FONT><B><FONT color=#a62828>"</FONT></B>
<B><FONT color=#a62828>exit</FONT></B> <FONT color=#ff00ff>1</FONT>
<B><FONT color=#a62828>esac</FONT></B>
<B><FONT color=#a62828>exit</FONT></B> <FONT color=#ff00ff>0</FONT>
</PRE>
</blockquote>
<p>Install this script and run it with the "start" option to start up the
database. Running it with the "stop" option shuts the database down. To
access a database, it must be running.</p>
<p>You can control which instances start at boot time using the following
commands. To get each instance to start at boot time, you need to run the
following command as root for each instance:</p>
<blockquote>
<b>/usr/IBMdb2/V7.1/bin/db2iauto -on INSTANCE_USER</b>
</blockquote>
<p>Where INSTANCE_USER is replaced by the username of the user associated with
the instance you want to start at boot time.</p>
<p>If you want to disable an instance from starting at boot time, you need to
run the following command as root for each instance:</p>
<blockquote>
<b>/usr/IBMdb2/V7.1/bin/db2iauto -off INSTANCE_USER</b>
</blockquote>
</body>
</html>
|