IBM DB2 database software offers industry leading performance, scale, and reliability on your choice of platform from Linux, Unix and Windows to z/OS.
IBM DB2 database comes in following editions
- Enterprise Server Edition
- Advanced Enterprise Server Edition
- Workgroup Server Edition
- Express Edition
For this tutorial we are going to install IBM DB2 Express-C 10.1 edition on Ubuntu 12.04 and Ubuntu 12.10 32 bit OS.
IBM DB2 Express-C is the free edition of the IBM DB2 database server. You can download and install DB2 Express-C on your own machine freely. You can also provision your own DB2 Express-C server in the cloud. Finally, there is a set of free tools for administration and development.
The most important thing about IBM DB2 Express-C is it provides all the core capabilities of DB2 at no charge.
To download IBM DB2 go to http://www-01.ibm.com/software/data/db2/express/download.html
Step 1: Install the base system
Here I am assuming that you are installing IBM DB2 Express-C on fresh Ubuntu 12.04 installation.
Step 1.1 You need to run following commands to upgrade your system as latest stable and other useful packages:
sudo apt-get update sudo apt-get -y install aptitude tasksel sudo aptitude update sudo aptitude -y full-upgrade sudo tasksel install openssh-server sudo tasksel install server sudo tasksel install mail-server sudo aptitude -y install colordiff mlocate ntp pwgen rsync vim
Also note that you must have X11 server install on the ubuntu box. If you are connecting to the ubuntu box using putty you have to enable X11 forwarding. Refer this post to simplify the process.
Run following commands to install X11 server
sudo aptitude -y install lxde-core xorg
Step 1.2 Check your /etc/hostname and update as below:
Step 1.3 Check your /etc/hosts and update as below:
127.0.0.1 localhost.localdomain localhost
Step 1.4 Check your /etc/resolv.conf and update as below:
Step 1.5 Set the timezone properly by running following command
sudo dpkg-reconfigure tzdata
At this point your Ubuntu 12.04 should basically configure for installing DB2 Express-C 10.1. Reboot your machine.
Step 2: Check your hardware setup
Step 2.1 First of all, you need to have AT LEAST 1GB of physical memory (I use 2GB here). Check it with:
grep MemTotal /proc/meminfo
Step 2.2 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
Step 2.3 Shared memory is very important, too. Or else you may face the ORA-00845 error message. First check it with:
df -kh /dev/shm/
Step 2.3.1 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
Step 2.3.2 Then remount it and check the size once again:
mount -o remount /dev/shm df -kh /dev/shm/
Step 3: Install dependence packages
As I assume you have Ubuntu 12.04 installed correctly with X11, we just need to install some more packages for IBM DB2 Express-C.
Run following command to install dependencies
sudo 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
Step 4: Configure kernel parameters
Step 4.1 We also need to modify the kernel parameter, to do so run following commands as root
echo "#">> /etc/sysctl.conf echo "# Oracle 11gR2 entries">> /etc/sysctl.conf echo "fs.aio-max-nr=1048576" >> /etc/sysctl.conf echo "fs.file-max=6815744" >> /etc/sysctl.conf echo "kernel.shmall=2097152" >> /etc/sysctl.conf echo "kernel.shmmni=4096" >> /etc/sysctl.conf echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf echo "net.ipv4.ip_local_port_range=9000 65500" >> /etc/sysctl.conf echo "net.core.rmem_default=262144" >> /etc/sysctl.conf echo "net.core.rmem_max=4194304" >> /etc/sysctl.conf echo "net.core.wmem_default=262144" >> /etc/sysctl.conf echo "net.core.wmem_max=1048586" >> /etc/sysctl.conf echo "kernel.shmmax=1073741824" >> /etc/sysctl.conf
Note: kernel.shmmax = max possible value, e.g. size of physical memory in bytes. In my case machine is having 2GB so we are specifying 1GB. Adjust the parameter as per your configuration
Step 4.2 Load new kernel parameters, by running following,
sudo sysctl -p
Step 5: Extracting binaries
Step 5.1 First of all, login with root, with X enabled.
Step 5.2 Copy the file db2_v101_linuxx64_expc.tar.gz to temporary directory, then extract it:
cp db2_v101_linuxia32_expc.tar.gz /usr/local/src cd /usr/local/src tar zxvf db2_v101_linuxia32_expc.tar.gz
Reboot your machine.
Step 6: Starting Installation
Step 6.1 First of all login with root and start the X11 with startx, then start the installer with:
cd /usr/local/src/expc/ ./db2setup
Step 6.5 In “Select installation, response file creation, or both” just use default setup:
Step 6.6 In “Select the features to install” I just click “Select all” so everything should install correctly:
Step 6.14 In “Set up notifications” I selected “Do not set up your DB2 server to send notification at this time” as I have not setup the mail server:
Step 6.15 In “Configure the DB2 Text Search service”, again just keep as default:
I have copied the configuration details for ref
Product to install: DB2 Express-C Installation type: Custom Previously Installed Components: Selected Components: Base client support Java support SQL procedures Base server support Communication support - TCP/IP DB2 data source support Spatial Extender server support DB2 LDAP support DB2 Instance Setup wizard Base application development tools DB2 Update Service First Steps Sample database source DB2 Text Search Languages: English All Products Target directory: /app/ibm/db2/V10.1 Space required: 751 MB New instances: Instance name: db2inst1 Start instance on reboot: Yes TCP/IP configuration: Service name: db2c_db2inst1 Port number: 50000 Instance user information: User name: db2inst1 Group name: db2iadm1 Home directory: /home/db2inst1 Fenced user information: User name: db2fenc1 Group name: db2fadm1 Home directory: /home/db2fenc1 DB2 Text Search: HTTP service name: db2j_db2inst1 HTTP service port number: 55000 DB2 Administration server: Instance user information: User name: dasusr1 Group name: dasadm1 Home directory: /home/dasusr1 Response file name: /root/db2expc.rsp
Step 7: Post-installation procedure
Before we go to next step, let’s check the following tasks:
Step 7.1 The default shell for dasuser1, db2instl and db2fencl are sh. Edit /etc/passwd and update them as bash.
Step 7.2 Kill your X, logout, re-login with db2inst1, then run startx (or directly for db2fs/db2cc if you are using Putty + Xming)
Step 7.3 Open a terminal and start db2fs: