Wednesday, September 29, 2010

Install DB2 on Mac OS X

I helped to testing ActiveRecord-JDBC with DB2 on my Macmini. But there are two big traps. In this article, I write about the first trap : Install DB2 on Mac OS X. I have researched with IBM developerWorks, Antonio Cangiano's blog, Google and Google.

Choose Installer

I use DB2 Express-C for this test. But, unfortunately, There are no V9.7.x installer for Mac OS X. So I choose the V9.5.2 beta installer.

Pre-install settings

Add below settings in the tail of /etc/sysctl.conf:
kern.sysv.shmmax=1073741824
kern.sysv.shmmin=1
kern.sysv.shmmni=4096
kern.sysv.shmseg=32
kern.sysv.shmall=1179648
kern.maxfilesperproc=65536
kern.maxfiles=65536

Install

$ tar -zxvf db2exc_952beta_MAC_x86_64.tar.gz
$ cd exp
$ sudo ./db2_install
$ sudo /opt/IBM/db2/V9.5/instance/db2icrt -a server -u fenced_user_name instance_user_name
And because of installer's bug, LD_LIBRARY_PATH is not setted correctly. So you can edit ~/sqllib/userprofile manually like below:
LD_LIBRARY_PATH=/Users/instance_user_name/sqllib/lib32
export LD_LIBRARY_PATH
I set my default user name for both fenced_user_name and instance_user_name

Post-install settings

At first, re-login or re-start Mac OS X, then start settings:
$ sudo db2 update dbm cfg using instance_memory automatic
$ sudo db2 update dbm cfg using SVCENAME service_name
$ sudo db2set DB2COMM=tcpip
And add below settings in the tail of /etc/services
service_name 50000/tcp
For instance, I set the service name as db2c_db2inst1.

Start DB2

$ sudo db2start
Check the listen port
$ netstat -an | grep 50000
tcp46      0      0  *.50000                *.*                    LISTEN

No comments:

Post a Comment