How to install IBM DB2 on Red Hat 6 Linux

I have never had direct contact with DB2 database or I know something more about it. I got the task to install this DB for some testing – which I did. I do a Google search how to install, of course – I looked at the official instruction in which I usually almost always missed something and installed it as I guess it’s appropriate, and I put this manual here if someone needs it.

People talk about IBM DB2 database some very nice words –  great stability and excellent speed … it was tested from my side – insert of 3 million lines with 3 columns has took only a few seconds. What still adorns this database is that it is one of the most expensive – but you can test it because IBM gives you the opportunity of 90 days of trial period to test – so if you represent a company…ask your local IBM partners about license, support and around the IT staff or DBA. About DB2, for now, I only know how the installation process and the boot up of the base run – with the BLU Accelerator, I did not go deeper into matter, backups, structure, and the like.

You can download the trial version from this link. Installation is done on Red Hat 6 Minimal Install. I tried installation on CentOS 6 – but without success – some kernel-sources stuff missing.

# Update everything. If kernel is updated - do a restart
yum update -y

cd /home 
# Copy here downloaded installation archive (v11.1_linuxx64_server_t.tar.gz)

# Extract
tar zxvf v11.1_linuxx64_server_t.tar.gz
rm -f v11.1_linuxx64_server_t.tar.gz

# Needed packages
yum install gcc gcc-c++ libstdc++*.i686 numactl sg3_utils kernel-devel compat-libstdc++-33.i686 compat-libstdc++-33.x86_64 pam-devel.i686 pam-devel.x86_64 

# Add IP and hostname in hosts file
echo "`ip addr | grep 'state UP' -A2 | grep 'inet ' | tail -n1 | awk '{print $2}' | cut -f1  -d'/'`  `hostname`" >> /etc/hosts
cat /etc/hosts # Provera

# GUI installation
yum groupinstall "Desktop" "X Window System" "Fonts"

# Disable firstboot
chkconfig firstboot off

# Disable selinux
sed -i s/"SELINUX=enforcing"/"SELINUX=disabled"/g /etc/selinux/config 

# Chech everything about DB2 needs with bellow command
# DBT3533I  The db2prereqcheck utility has confirmed that all installation prerequisites were met.

# Install VNC and run installation with db2setup 
yum install tigervnc-server
vncserver # Put a VNC password

It remains to complete the installation through the GUI and through the VNC or direct access to the machine. Steps attached.

After the installation, it remains to install the database – which in this case will be boosted with the BLU Accelerator that is supposedly revolutionary when it comes to performance – and to place such a base rising automatically with the system

# Create database
su - db2inst1
db2 create database KOMP_DB2
db2 activate db KOMP_DB2
db2 connect to KOMP_DB2

# Add to crontab with next script
echo \
source /home/db2inst1/.bashrc
sleep 5
db2 connect to KOMP_DB2' > /home/db2inst1/

chmod +x /home/db2inst1/
(crontab -l 2>/dev/null; echo "@reboot /home/db2inst1/ > /tmp/DB2start.log 2>&1") | crontab -

It’s still up to you to try logging in to the database and seeing ‘does it work’. I used the Oracle SQL Developer for testing (I was also surprised) but I added db2jcc.jar through tools > preferences > database > third party JDBC drivers

If everything is OK with the concession, the installation is completed and you can start working for the next 90 days during the trial period.