old-www/HOWTO/DB2-HOWTO/ubuntu704.html

618 lines
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Installing DB2 Express-C on Ubuntu 7.04 'Feisty Fawn'</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="IBM DB2 Express-C for Linux HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Installing DB2 Express-C on Ubuntu 6.06 LTS 'Dapper Drake'"
HREF="ubuntu606.html"><LINK
REL="NEXT"
TITLE="Installing DB2 Express-C on SimplyMEPIS 6.0"
HREF="mepis6.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>IBM DB2 Express-C for Linux HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="ubuntu606.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="mepis6.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="ubuntu704"
></A
>16. Installing DB2 Express-C on Ubuntu 7.04 'Feisty Fawn'</H1
><P
>These installation notes are based on a single-partition installation
using the 2.6.20-16-generic kernel.</P
><P
>Note that IBM does not yet officially support this distribution for DB2
9. Any problems you encounter using this distribution must be replicated on a
supported distribution before IBM Support can help you resolve the
issue.</P
><P
>Also be aware that the PowerPC architecture is no longer supported in
Ubuntu 7.04 and later.</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN770"
></A
>16.1. Installation notes</H2
><P
>Since you cannot log in as root directly with an Ubuntu system, this
DB2 installation is run as the default user created during Ubuntu
setup (i.e. the regular user account with 'sudo' capability).</P
><P
>There are two ways of installing DB2 Express-C 9 on Ubuntu. The harder
of the two methods is to use the default DB2 <B
CLASS="command"
>db2setup</B
>,
and then make adjustments to the Ubuntu system afterwards to handle the
slight differences of Ubuntu's Debian-based packaging system. For
reasons of clarity and brevity, I will omit the instructions for doing it
this more difficult way; however, if you would like to see these
instructions, please send me an email (db2howto@gmail.com) and I will
pass them along.</P
><P
>The easy way to install DB2 Express-C on Ubuntu 7.04 is to download
the DB2 Express-C Debian package file and then use the Ubuntu package
installer. This way, almost everything is done for you, from installation to
configuration. Here's how to do it:
<P
></P
><OL
TYPE="1"
><LI
><P
>Use any FTP client software and connect to:
<A
HREF=""
TARGET="_top"
>ftp.software.ibm.com/software/data/db2/express/latest_debs</A
>
</P
></LI
><LI
><P
>Download <TT
CLASS="filename"
>db2exc_9.1.2-1_i386.deb</TT
> (or the
latest equivalent .deb file)
</P
></LI
><LI
><P
>Once the download is complete, run this command:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>sudo gdebi-gtk db2exc_9.1.2-1_i386.deb</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
>Click "<B
CLASS="command"
>Install Package</B
>"</P
></LI
><LI
><P
>Click "<B
CLASS="command"
>Close</B
>" once the package has been
installed</P
></LI
></OL
>
After hitting the "<B
CLASS="command"
>Install Package</B
>" button, the Ubuntu
package installer will unpack and install the package and configure the DB2
users and default instance. Click the "<B
CLASS="command"
>Close</B
>" button
once the installation is complete.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN794"
></A
>16.2. Post-installation notes</H2
><P
></P
><P
>After installation by Synaptic, there are a few steps required to get
DB2 up and running smoothly.
<P
></P
><OL
TYPE="1"
><LI
><P
>Usable passwords for the DB2 default accounts.</P
><P
>To actually log in or connect to the DB2 databases and servers
using the default DB2 users (db2inst1, db2fenc1, and dasusr1), you need
to modify the initial passwords. To do this, open a terminal (as the
regular user), and type <B
CLASS="command"
>sudo su -</B
> to get root access.
Then run these three commands:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>passwd db2inst1
passwd db2fenc1
passwd dasusr1</PRE
></FONT
></TD
></TR
></TABLE
>
Each time you will be asked to set the new password for the specified
user account.
</P
></LI
><LI
><P
>Change the default shell for the DB2 default accounts.</P
><P
>The default command shell for the DB2 accounts is set as just a
plain old <B
CLASS="command"
>/bin/sh</B
>. To get the handy features of the
BASH shell, you'll want to change it for these three accounts. In the
same root access command window, open the
<TT
CLASS="filename"
>/etc/passwd</TT
> file in your favorite text editor and
change:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;db2inst1:x:1001:1001::/home/db2inst1:/bin/sh
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/sh
dasusr1:x:1003:1003::/home/dasusr1:/bin/sh</PRE
></FONT
></TD
></TR
></TABLE
>
to
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;db2inst1:x:1001:1001::/home/db2inst1:/bin/bash
db2fenc1:x:1002:1002::/home/db2fenc1:/bin/bash
dasusr1:x:1003:1003::/home/dasusr1:/bin/bash</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
>Enable DB2 service ports for remote connections.</P
><P
>To enable outside users to get to your DB2 databases, you'll need
to set up the DB2 service port, as it is not configured by the Synaptic
installation process.</P
><P
>As the regular user, run <B
CLASS="command"
>sudo vi /etc/services</B
>
and add this line to the end of the file:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>db2c_db2inst1 50001/tcp # IBM DB2 instance - db2inst1</PRE
></FONT
></TD
></TR
></TABLE
>
Then, as the DB2 instance owner (db2inst1 by default), run these commands:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>db2 update dbm cfg using SVCENAME db2c_db2inst1
db2set DB2COMM=tcpip
db2stop
db2start</PRE
></FONT
></TD
></TR
></TABLE
>
Now remote users will be able to connect to the DB2 databases on your
Ubuntu system.
</P
></LI
><LI
><P
>Enable remote DB2 administration connections.</P
><P
>To allow remote administration of your DB2 server, you'll need to
set up the DB2 DAS connection port, as it is not configured by the
Synaptic installation process.</P
><P
>As the regular user, run <B
CLASS="command"
>sudo vi /etc/services</B
>
and add this line to the end of the file:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>ibm-db2 523/tcp # IBM DB2 DAS
ibm-db2 523/udp # IBM DB2 DAS</PRE
></FONT
></TD
></TR
></TABLE
>
Then, as the DB2 DAS owner (dasusr1 by default), run these commands:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>db2admin stop
db2admin start</PRE
></FONT
></TD
></TR
></TABLE
>
Now remote administrators can connect to the DAS server to administer
databases on your Ubuntu system.
</P
></LI
><LI
><P
>Correct instance restart problem</P
><P
>One issue of note with the Ubuntu 7.04 installation is that the
DB2 instances do not properly restart after a system reboot, and setting
DB2AUTOSTART=YES does not resolve the issue.</P
><P
>One workaround to this problem was suggested in part by
IgorM on the DB2 Express-C forum; and that is to create and execute your
own DB2 instance start up script.
</P
><P
>To begin with, login and create a new script file using the command:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>sudo vi /etc/init.d/db2</PRE
></FONT
></TD
></TR
></TABLE
>
and then insert this text:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>#!/bin/sh
#
# Script to start DB2 instances on bootup.
#
set -e
. /lib/lsb/init-functions
case "$1" in
start)
/opt/ibm/db2exc/V9.1/instance/db2istrt
;;
stop|restart|reload)
;;
esac
exit 0</PRE
></FONT
></TD
></TR
></TABLE
>
and write the file to disk with the <B
CLASS="command"
>:wq</B
> vi command.
</P
><P
>&#13; Note that the path to the executable is
<B
CLASS="command"
>/opt/ibm/db2exc/V9.1/</B
>, the default installation path
from the DB2 .deb file. If your installation put the DB2 files
elsewhere, be sure to adjust this script as required to find the
/instance/ directory.
</P
><P
>Once the script has been saved, give the file the proper ownership
and permissions:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>chown root.root db2
chmod 755 db2</PRE
></FONT
></TD
></TR
></TABLE
></P
><P
>Now, to initialize this script so that it starts at boot time,
install the Boot-Up Manager with this command:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>sudo apt-get bum</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>After Synaptic downloads and installs the application file, you
can run the program by clicking <B
CLASS="command"
>System -&#62; Administration -&#62;
BootUp-Manager</B
>. Then click on the "Activate" checkbox beside
the <B
CLASS="command"
>db2</B
> entry. Click <B
CLASS="command"
>Apply</B
> and
say "No" to the dialog that asks if you want to start the service now.
Click <B
CLASS="command"
>Quit</B
>. The script will now run at your next boot and
start up all DB2 instances.
</P
><P
>The only other way to resolve the problem is to manually
start the instances after a reboot with <B
CLASS="command"
>db2start</B
> (as
the instance owner) and <B
CLASS="command"
>db2admin start</B
> (as the DAS
owner). Once DB2 Express-C has passed the validation process for Ubuntu
7.04, this instance start issue will disappear.
</P
></LI
></OL
>
</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="ubuntu606.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="mepis6.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Installing DB2 Express-C on Ubuntu 6.06 LTS 'Dapper Drake'</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Installing DB2 Express-C on SimplyMEPIS 6.0</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>