How to install DB2 Express-C 9 on Mac OS X in about 10 minutes
The very first step of my DB2 adventure is, of course, the installation party. I would like to share a brief how to installation guide of DB2 on Mac.
FYI, there is already a PDF guide when you download DB2 Express-C package which I will mainly follow. However I will comment as first person experience with some extra useful comments and avoid useless details. So let's make it simple and fast but efficient.
First of all there are some pre-requisites:
- You have to be on Leopard ;
- You have to have root access ;
Ok now we can download the application. Once done, open a terminal and get ready to start.
Configuring the System
In order to have DB2 running on the Mac, some configurations will have to be performed. The first one will affect sysclt.
The sysctl utility retrieves kernel state and allows processes with appropriate privilege to set kernel state. The state to be
retrieved or set is described using a ``Management Information Base'' (``MIB'') style name, described as a dotted set of components.
Locate your sysctl.conf (which should not exist or be on /etc/sysctl.conf)
[geshifilter-code language="bash"]
nuno@mac ~ $ locate sysctl.conf
[/geshifilter-code]
Then edit or create the file on /etc/sysctl.conf and insert the following content:
[geshifilter-code language="apache"]
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
[/geshifilter-code]
It will set some settings for shared memory and user limits to allow DB2 to run on Mac. Just save the file and reboot your Mac so the changes will take effect. I'll be back...
Ok, I'm back after approximately 02:29.6 minutes (a little long reboot in my opinion). So, once rebooted, make sure that you have Java 1.6 on your system. This is a requirement for GUI support. You can use Java 1.5 with db2_install/db2icrt scripts but the GUI will not be supported. Finally let's expand you zipped files:
[geshifilter-code language="bash" ]
nuno@mac ~ $ tar zxvf db2exc_952beta_MAC_x86_64.tar
nuno@mac ~ $ cd exp
[/geshifilter-code]
Installing DB2 Express-C
You should be aware that installing DB2 as common user will have limitations that you can avoid installing with root. Anyway, the db2rfe script allows you to switch between standard user to root installation anytime you need.
There are two ways to install DB2: by GUI or with an installation script. I'll go for the root one:
[geshifilter-code language="bash"]
nuno@mac ~ $ sudo ./db2setup
[/geshifilter-code]
It just lunches a GUI with IBM DB2 Setup Lunchpad. Select "Install a Product", "Install New" and follow the wizard. I kept the "Typical Installation" so I am sure everything I need will be installed. There is an important step that should be explained carefully. When the installation process asks you to set the "user information for the DB2 instance owner". There you must specify an existing user in your system to own the DB2 instance. In the need, you can create a new user in the system via System Preferences during de installation process. In this case I picked the existing user nuno.
Extra steps
Ok, now that DB2 is installed on your system, let's make a couple of configurations in order to have DB2 working on your Mac. Let's remember that in this particular case the owner of the DB2 instance is the user nuno. So when we jump to the home folder of that user, we can see a folder called sqllib. We will have to proceed to some final configuration to get ready for work. The first one is to put libs and bins on your path environment variable. Nothing complicated, the dish is already ready for you; the only thing you should do is:
[geshifilter-code language="bash"]
nuno@mac ~ $ source /User/nuno/sqllib/db2profile
[/geshifilter-code]
We are almost there! There is one task left which is not mandatory but highly recommendable so that you can run "DB2 First Steps" to get some more information about DB2. Unfortunately this HTML manual does not support -- yet! -- Safari, so you will have to download Firefox to be able to browse it. The DB2 installation has a binary that lunches DB2 First Steps on Firefox. Be sure you are logged in as the DB2 instance owner (in my case, nuno) and go to the home directory. Before running the binary, let's see if you have required environment variable set up.
[geshifilter-code language="bash"]
nuno@mac ~ $ echo $LANG
nuno@mac ~ $ echo $LC_ALL
[/geshifilter-code]
If if your echo shows empty variable or anything other than en_XX (where XX are any couple of letters), you have to configure as shown below. Otherwise you can skip the following step. Let's assume that I have no language environment variable set so I have to do the follwoing:
[geshifilter-code language="bash"]
nuno@mac ~ $ export LANG=en_GB.UTF-8
nuno@mac ~ $ export LC_ALL=en_GB.UTF-8
[/geshifilter-code]
Note I used en_GB because that's what I use in all my apps but you can use en_AU, en_CA, en_US or any other English code (more informations here: http://www.iana.org/assignments/language-subtag-registry).
Finally you are ready to open the DB2 First Steps to get started with DB2 Express-C 9! Last thing to do is
[geshifilter-code language="bash"]
nuno@mac ~ $ db2fs
[/geshifilter-code]
or
[geshifilter-code language="bash"]
nuno@mac ~ $ sqllib/bin/db2fs
[/geshifilter-code]
if your terminal needs to apply $PATH changes. All you have to do is to specify on GUI opened window the path for firebox binary which is /path/to/Firefox.app/Contents/MacOS/firefox. Now read carefully the documentation to get started with DB2. That's all folks :)
(Just a little note for IBM guys... Beside the compatibility with Safari, can you please add DB2 Database for Mac to all your DB2 references? Thanks! ;) hehe!)


















Comments
Post new comment