I highlighted in red. Also, my Ubuntu is Edge Edge instead of Dapper Drake. I'm not sure this matters but it is a difference.
I do this because you never know when someone's going to delete their blog or have it removed by higher powers.
The DB2 installation package is rpm-based, so we’ll need to install an rpm-compatible installer for Ubuntu. For this, we apt-get alien, an rpm package installer:
$ sudo apt-get install alienalso installed pdksh
sudo apt-get install pdksh
sudo apt-get install openssh-server
openssh-client was alread installed
sudo ./db2_install (from installation directory)
Now we may db2_install installation script that is bundled with DB2. This needs to be done as root:
$ tar xzvf db2exc_91_LNX_x86.tar.gz
$ sudo exp/disk1/db2_install
Here I simply used Archive Manager. In my installation is ran ./db2install from the directory where I extracted the tar file.
This should take a few minutes to install. At the time of this writing, the installation procedure had approximately ten steps and lasted about three to five minutes. Note that depending on the version of gcc that you have installed (if at all), you may need to install libstdc++5, as it is required for successful installation. This is easily obtained:
$ sudo apt-get install libstdc++5
Setting Up Groups/Users
Now that we have DB2 installed, we need to configure it for use. We start by creating the standard DB2 user groups: instance owners, fenced users, and administrators. (Note that these commands need to be run as root — the sudo is dropped here for notational simplicity and a # is added in its place for clarity).
# groupadd -g 999 db2iadm1
# groupadd -g 998 db2fadm1
# groupadd -g 997 dasadm1
Now we’ll create a default user for each group:
# useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1 -p password2
# useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
# useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1 -p password4
Creating the Adminstrative Database
Now we need to create a DB2 Administration Server to administer all instances of DB2 under the purview of this installation:
# /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1
Note here that dasusr1 may be any user that is a member of the dasadm1 group we set up earlier.
DB2 Instance Semantics. Creating an Instance.
A DB2 instance is an environment that acts as a logical container for a collection of databases. It’s an abstraction that allows the creation and usage of multiple independent DB2 environments using the same physical resources.
We need an instance to hold all of our databases. We’l create a default instance using the db2inst1 user we just created as its owner:
# /opt/ibm/db2/V9.1/instance/db2icrt -u db2fenc1 db2inst1
As we noted, db2inst1 is the instance owner, while db2fenc1 credentials are used to execute fenced stored procedures and executables.
Below lists the commands and output of the commands presented in the referenced blog.
The execution completed successfully.
For more information see the DB2 installation log at
rkathey@delllaptop:~/db2install$ sudo groupadd -g 999 db2iadm1
rkathey@delllaptop:~/db2install$ sudo groupadd -g 998 db2fadm1
rkathey@delllaptop:~/db2install$ sudo groupadd -g 997 dasadm1
rkathey@delllaptop:~/db2install$ sudo useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1 -p password2
rkathey@delllaptop:~/db2install$ useradd -u 1003 -g db2fadm1 -m -d rkathey@delllaptop:~/db2install$ useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
useradd: unable to lock password file
rkathey@delllaptop:~/db2install$ useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
useradd: unable to lock password file
rkathey@delllaptop:~/db2install$ sudo useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1 -p password3
rkathey@delllaptop:~/db2install$ sudo useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1 -p password4
rkathey@delllaptop:~/db2install$ sudo /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1
SQL4406W The DB2 Administration Server was started successfully.
DBI1070I Program dascrt completed successfully.
rkathey@delllaptop:~/db2install$ sudo /opt/ibm/db2/V9.1/instance/db2icrt -u db2fenc1 db2inst1
DBI1070I Program db2icrt completed successfully.
Starting and Stopping an Instance
A DB2 instance is an environment that acts as a logical container for a collection of In order to start and stop the DB2 instance (remember, we may have multiple instances for a given installation on a physical host), we log in as the owner and call db2start after inializing the DB2 environment:
$ su db2inst1
ADM12026W The DB2 server has detected that a valid license for this product has not been registered.
SQL1063N DB2START processing was successful.
Creating database "SAMPLE"...
Connecting to database "SAMPLE"...
Creating tables and data in schema "DB2INST1"...
Creating tables with XML columns and XML data in schema "DB2INST1"...
'db2sampl' processing complete.
You may enable (or disable) automatic DB2 instance start/stop on system start-up/shut-down by calling:
$ db2iauto -on db2inst1
where db2inst1 is the login name of the instance. Replacing the -on flag with -off disables this feature.
The Sample Database
If you wish to build the sample database bundled with DB2 in order to play around, call db2sampl while logged into a DB2 instance owner account:
$ su db2inst1
$ . ~/sqllib/db2profile
After this I logged into db2inst1, ran the db2profile (as above) and launched db2ca to enter the graphical user interface. Thanks to the original author for the ubuntu db2 install.