DB2 Express-C 10.1 on Ubuntu 12.04 HOWTO

This HOWTO will guide you though installation of DB2 Express-C 10.1 on Ubuntu 12.04.

Before start I will assume you have a clean Ubuntu Server 12.04 installed with minimal packages requirement. It is strongly recommend to install on a new host, as it will modify a lot of default settings ;-)

Install the base system

First of all you should install Ubuntu 12.04 with minimal packages, almost nothing else is required at the beginning.

After initial installation run the following command to upgrade your system as latest stable + some optional useful packages:

aptitude update && \
aptitude -y full-upgrade && \
tasksel install openssh-server && \
tasksel install server && \
tasksel install mail-server && \
aptitude -y install colordiff mlocate ntp pwgen rsync vim

In case you are NOT using remote X11 with SSH so local GUI is required, install additional packages as below:

aptitude -y install lxde-core xorg

Once everything get ready you may start the GUI and test with:

startx

Check your /etc/hostname and update as below:

localhost.localdomain

Check your /etc/hosts and update as below:

127.0.0.1       localhost.localdomain   localhost

Check your /etc/resolv.conf and update as below:

search localdomain

In case of using OpenStack VM, default search domain assigned by DHCP would be "novalocal"; therefore we need to update /etc/dhcp/dhclient.conf as below:

supersede domain-name "localdomain";
supersede domain-search "localdomain", "novalocal";

Then restart network by:

/etc/init.d/networking restart

Running /etc/init.d/hostname.sh (or simply reboot your Ubuntu), then test the hostname of system with:

hostname

Remeber to double check if time zone setup correctly:

dpkg-reconfigure tzdata

Ok up to this point your Ubuntu 12.04 should basically configure for installing DB2 Express-C 10.1.

Check your hardware setup

First of all, you need to have AT LEAST 1GB of physical memory (I use 2GB here). Check it with:

grep MemTotal /proc/meminfo

On the other hand, it is suggest to have swap with 1.5 time of your physical memory, e.g. around 2GB. Check it with:

grep SwapTotal /proc/meminfo

In case I am using libvirt + KVM VM client, I don't hope to create swap partition by default or else if all VMs are running out of resourse they will all keep on swapping to harddisk and finally all gone...

Here I will create a temperate swap file and activate it during installation; once reboot it will gone automatically (or manually disable it with swapoff /tmp/swap):

dd if=/dev/zero of=/tmp/swap bs=1M count=4096
chmod 600 /tmp/swap
mkswap /tmp/swap
swapon /tmp/swap
grep SwapTotal /proc/meminfo

Shared memory is very important, too. Or else you may face the ORA-00845 error message. First check it with:

df -kh /dev/shm/

If you have less than 512MB (I will suggest for 1GB), edit your /etc/fstab and add/modify the following line:

tmpfs           /dev/shm        tmpfs   defaults,size=1024M    0       0

Then remount it and check the size once again:

mount -o remount /dev/shm
df -kh /dev/shm/

Install dependence packages

As I assume you have Ubuntu 12.04 installed correctly with X11, we just need to dig into dependence packages installation directly (in case of AMD64):

aptitude -y install alien binutils build-essential cpp-4.4 debhelper g++-4.4 gawk gcc-4.4 gcc-4.4-base gettext html2text ia32-libs intltool-debian ksh lesstif2 lib32bz2-dev lib32z1-dev libaio-dev libaio1 libbeecrypt7 libc6 libc6-dev libc6-dev-i386 libdb4.8 libelf-dev libelf1 libltdl-dev libltdl7 libmotif4 libodbcinstq4-1 libodbcinstq4-1:i386 libqt4-core libqt4-gui libsqlite3-0 libstdc++5 libstdc++6 libstdc++6-4.4-dev lsb lsb-core lsb-cxx lsb-desktop lsb-graphics lsb-qt4 make odbcinst openjdk-6-jdk pax po-debconf rpm rpm-common sysstat tzdata-java unixodbc unixodbc-dev unzip

Configure kernel parameters

Check your existing setup with:

/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default
/sbin/sysctl -a | grep rmem_max
/sbin/sysctl -a | grep wmem_default
/sbin/sysctl -a | grep wmem_max

Create /etc/sysctl.d/99-ibm.conf and add the following lines:

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

Run the following command to reload these kernel parameters:

service procps start

Last step before installation start

First of all, login with root, with X enabled.

If you are using PuTTY + Xming, for sure that the X11 forward is enabled.

Copy the file db2_v101_linuxx64_expc.tar.gz to temporary directory, then extract it:

cp db2_v101_linuxx64_expc.tar.gz /usr/local/src
cp db2_v101_linuxx64_nlpack.tar.gz /usr/local/src
cd /usr/local/src
tar zxvf db2_v101_linuxx64_expc.tar.gz
tar zxvf db2_v101_linuxx64_nlpack.tar.gz
rsync -av /usr/local/src/nlpack/ /usr/local/src/expc
rm -rf /usr/local/src/nlpack

I will STRONGLY suggest for a complete reboot, and double-check ALL pre-installation BEFORE starting the next step.

First of all login with root and start the X11 with startx, then start the installer with:

cd /usr/local/src/expc/ && ./db2setup

Next we go though the installation:

Choose "Install a Product" then press on "Install New":

The "Welcome to the DB2 Setup wizard" screen will now show up:

We must accept the "Software License Agreement";

During "Select the installation type" I would like to use "Custom: 10 - 390 MB" installation so able to get full control:

In "Select installation, response file creation, or both" just use default setup:

In "Select the features to install" I just click "Select all" so everything should install correctly as expected for R&D:

In "Select the languages to install" again I choose all languages:

In "Specify the location of the DB2 Information Center" I will get information by "On the IBM Web site":

In "Set user information for the DB2 Administration Server", create the user for DAS (1/3 or DB2 users):

In "Set up a DB2 instance", choose "Create a DB2 instance":

In "Set user information for the DB2 instance owner", we will create an user account for our new instance (2/3 or DB2 users):

In "Set user information for the fenced user", create user account as similar as above (3/3 or DB2 users):

In "Configure instance communication and startup", just keep as default:

In "Set up notifications" just keep as default (for sure that you should also setup local SMTP server correctly):

In "Specify a contact for health monitor notification" just keep as default:

In "Configure the DB2 Text Search service", again just keep as default:

Ok is time for final confirmation, we also get it done:

And now let's go for a coffee break ;-)

Ok you get it!

Post-installation procedure

Before we go to next step, let's check the following tasks:

  • The default shell for dasuser1, db2instl and db2fencl are sh. Edit /etc/passwd and update them as bash.
  • Kill your X, logout, re-login with db2instl, then run startx (or directly for db2fs/db2cc if you are using Putty + Xming)

Open a terminal and start db2fs:

db2fs

db2fs will ask for your default web browser. Answer /usr/bin/firefox here:

This will open the "First Steps for DB2 Database for Linux, UNIX, and Windows" in Firefox. Now click on "Create SAMPLE database:

In "First Steps - Create SAMPLE Database", just keep as default:

Again, let's have a coffee break and it should be done within 3 mins ;-)

Comments

nick's picture

it ws helpfull...

thanks

Joro's picture

Thanks, it help me a lot with Ubuntu 12.04. Could you updatae the article to Ubuntu 12.10 or maybe a month later to 13.04?

Mario's picture

Thank you so much. I did this in Ubuntu 13.10. Only the last part (SAMPLE DATEBASE) failed when execute db2fs and select the path.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • HTML tags will be transformed to conform to HTML standards.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.