<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MaxZinal</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MaxZinal"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/MaxZinal"/>
	<updated>2026-05-15T16:24:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=DB2_installation&amp;diff=9128</id>
		<title>DB2 installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=DB2_installation&amp;diff=9128"/>
		<updated>2010-09-20T05:57:09Z</updated>

		<summary type="html">&lt;p&gt;MaxZinal: /* Set VE resource limits appropriately */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DB2 has been certified by IBM for use inside Virtuozzo. It works in OpenVZ too!&lt;br /&gt;
&lt;br /&gt;
IBM provides a free download of DB2 Express-C which is what I&lt;br /&gt;
installed.&lt;br /&gt;
&lt;br /&gt;
Here is a rough guide to installing DB2 into a freshly-created VE.&lt;br /&gt;
&lt;br /&gt;
== Create a new VE ==&lt;br /&gt;
&lt;br /&gt;
I created a new VE for the Debian distribution using debootstrap, as described in [[Debian template creation]].&lt;br /&gt;
&lt;br /&gt;
== Set VE resource limits appropriately ==&lt;br /&gt;
&lt;br /&gt;
DB2 installation can fail and it will not be possible to operate the database if your resource limits are too low. I used these limits for a small database:&lt;br /&gt;
&lt;br /&gt;
* kmemsize to 10,000,000&lt;br /&gt;
* privvmpages to 300,000&lt;br /&gt;
* shmpages to 80,000&lt;br /&gt;
* numproc to 150&lt;br /&gt;
* tcpsndbuf to 700,000&lt;br /&gt;
* tcprcvbuf to 700,000&lt;br /&gt;
* diskspace to 6,000,000&lt;br /&gt;
&lt;br /&gt;
{{Inconsistent UBC warning}}&lt;br /&gt;
&lt;br /&gt;
These are tested resource limits for x86-64 system running Debian/GNU Linux 5.0.6 (the settings above did not work very well):&lt;br /&gt;
&lt;br /&gt;
* kmemsize to 26214400:29491200&lt;br /&gt;
* privvmpages to 2097152:unlimited&lt;br /&gt;
* shmpages to 1572864&lt;br /&gt;
* numproc to 400&lt;br /&gt;
* tcpsndbuf to 1720320:2703360&lt;br /&gt;
* tcprcvbuf to 1720320:2703360&lt;br /&gt;
* vmguardpages to 2097152:unlimited&lt;br /&gt;
* oomguardpages to 26112:unlimited&lt;br /&gt;
&lt;br /&gt;
And according to DB2 9 documentation, the following minimal guest kernel options must be set in /etc/sysctl.conf:&lt;br /&gt;
&amp;lt;pre&amp;gt;kernel.shmmax = 1073741824&lt;br /&gt;
kernel.sem = 250 256000  32 1024&lt;br /&gt;
kernel.msgmax = 65535&lt;br /&gt;
kernel.msgmnb = 65535&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Install additional packages ==&lt;br /&gt;
&lt;br /&gt;
* libstdc++5 (required for installation)&lt;br /&gt;
* pdksh (required for operation?)&lt;br /&gt;
* ssh   (may be required for operation)&lt;br /&gt;
* xbase-clients (for xauth)&lt;br /&gt;
* firefox (for post-installation)&lt;br /&gt;
* strace and telnet (for debugging)&lt;br /&gt;
* libdbi-perl gcc libc6-dev make (for building CPAN DBD::DB2 package)&lt;br /&gt;
&lt;br /&gt;
== Download the DB2 Express-C package ==&lt;br /&gt;
&lt;br /&gt;
DB2 Express-C version 9 is available from this page:&lt;br /&gt;
[[http://www-306.ibm.com/software/data/db2/express/download.html]]&lt;br /&gt;
&lt;br /&gt;
You will need to register with IBM before you can download.&lt;br /&gt;
&lt;br /&gt;
* Untar the received file as root&lt;br /&gt;
* Run exp/disk1/db2setup&lt;br /&gt;
* Follow the prompts:&lt;br /&gt;
** Setup user 'dasusr1'&lt;br /&gt;
** Setup user 'db2inst1' and database instance 'db2inst1'&lt;br /&gt;
&lt;br /&gt;
== Post-install actions ==&lt;br /&gt;
&lt;br /&gt;
This is where it gets yukky. DB2 wants to run a browser inside the VE. It wants to run Java applets inside the browser. I installed Iceweasel, but the post-install script does not recognise it. I was eventually able to hack the script to recognise and use the browser but it crashed on one of the Java applets. I think you can get by without running the post-install.&lt;br /&gt;
&lt;br /&gt;
Here's what to do instead:&lt;br /&gt;
&lt;br /&gt;
First, su to the instance owner:&lt;br /&gt;
&lt;br /&gt;
* su - db2inst1&lt;br /&gt;
&lt;br /&gt;
Try starting and stopping the database:&lt;br /&gt;
&lt;br /&gt;
* db2start&lt;br /&gt;
* db2stop&lt;br /&gt;
&lt;br /&gt;
If these don't work it means your environment variables are not set properly. IBM set these for me:&lt;br /&gt;
&lt;br /&gt;
 CLASSPATH=/home/db2inst1/sqllib/java/db2java.zip:/home/db2inst1/sqllib/java/db2jcc.jar:/home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/function:/home/db2inst1/sqllib/java/db2jcc_license_cu.jar:.&lt;br /&gt;
 DB2INSTANCE=db2inst1&lt;br /&gt;
 PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc&lt;br /&gt;
&lt;br /&gt;
Try creating IBM's sample database:&lt;br /&gt;
&lt;br /&gt;
* db2sampl&lt;br /&gt;
&lt;br /&gt;
== Setup a development environment ==&lt;br /&gt;
&lt;br /&gt;
I develop in perl so I was most interested in access to the database though the DBI library. I did this:&lt;br /&gt;
&lt;br /&gt;
* Use CPAN to download and install DBD::DB2&lt;br /&gt;
&lt;br /&gt;
If you don't use CPAN you can also do this (as root):&lt;br /&gt;
&lt;br /&gt;
* Download http://search.cpan.org/CPAN/authors/id/I/IB/IBMTORDB2/DBD-DB2-1.1.tar.gz&lt;br /&gt;
* Untar the file and change into the directory&lt;br /&gt;
* perl Makefile.PL PREFIX=/usr&lt;br /&gt;
* make&lt;br /&gt;
* make test&lt;br /&gt;
* make install&lt;br /&gt;
&lt;br /&gt;
== Setup DB2 for autostart ==&lt;br /&gt;
&lt;br /&gt;
It seems that DB2 can be auto-started at VE boot time, but not auto-stopped. I used this script:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 #&lt;br /&gt;
 # Script to start DB2 instances on bootup.&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 set -e&lt;br /&gt;
 &lt;br /&gt;
 . /lib/lsb/init-functions&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
 start)&lt;br /&gt;
         echo Starting DB2&lt;br /&gt;
         /opt/ibm/db2/V9.1/instance/db2istrt&lt;br /&gt;
         ;;&lt;br /&gt;
 stop)&lt;br /&gt;
         ;;&lt;br /&gt;
 restart|reload)&lt;br /&gt;
         ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
And I used this command to create the symlink to make it start at VE &amp;quot;boot&amp;quot; time:&lt;br /&gt;
&lt;br /&gt;
 update-rc.d db2 start 95 2 .&lt;br /&gt;
&lt;br /&gt;
== Testing your installation ==&lt;br /&gt;
&lt;br /&gt;
From the db2inst1 user, do:&lt;br /&gt;
&lt;br /&gt;
* db2&lt;br /&gt;
&lt;br /&gt;
Inside the db2 client, try:&lt;br /&gt;
&lt;br /&gt;
 connect to sample&lt;br /&gt;
 grant dbadm on database to user fred&lt;br /&gt;
 connect reset&lt;br /&gt;
&lt;br /&gt;
== Enjoy! ==&lt;br /&gt;
&lt;br /&gt;
Please provide feedback in the discussion (Talk) page about improvements to this HOWTO.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>MaxZinal</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=DB2_installation&amp;diff=9127</id>
		<title>DB2 installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=DB2_installation&amp;diff=9127"/>
		<updated>2010-09-20T05:53:29Z</updated>

		<summary type="html">&lt;p&gt;MaxZinal: /* Set VE resource limits appropriately */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DB2 has been certified by IBM for use inside Virtuozzo. It works in OpenVZ too!&lt;br /&gt;
&lt;br /&gt;
IBM provides a free download of DB2 Express-C which is what I&lt;br /&gt;
installed.&lt;br /&gt;
&lt;br /&gt;
Here is a rough guide to installing DB2 into a freshly-created VE.&lt;br /&gt;
&lt;br /&gt;
== Create a new VE ==&lt;br /&gt;
&lt;br /&gt;
I created a new VE for the Debian distribution using debootstrap, as described in [[Debian template creation]].&lt;br /&gt;
&lt;br /&gt;
== Set VE resource limits appropriately ==&lt;br /&gt;
&lt;br /&gt;
DB2 installation can fail and it will not be possible to operate the database if your resource limits are too low. I used these limits for a small database:&lt;br /&gt;
&lt;br /&gt;
* kmemsize to 10,000,000&lt;br /&gt;
* privvmpages to 300,000&lt;br /&gt;
* shmpages to 80,000&lt;br /&gt;
* numproc to 150&lt;br /&gt;
* tcpsndbuf to 700,000&lt;br /&gt;
* tcprcvbuf to 700,000&lt;br /&gt;
* diskspace to 6,000,000&lt;br /&gt;
&lt;br /&gt;
{{Inconsistent UBC warning}}&lt;br /&gt;
&lt;br /&gt;
These are tested resource limits for x86-64 system running Debian/GNU Linux 5.0.6 (the settings above did not work very well):&lt;br /&gt;
&lt;br /&gt;
* kmemsize to 26214400:29491200&lt;br /&gt;
* privvmpages to 2097152:unlimited&lt;br /&gt;
* shmpages to 1572864&lt;br /&gt;
* numproc to 400&lt;br /&gt;
* tcpsndbuf to 1720320:2703360&lt;br /&gt;
* tcprcvbuf to 1720320:2703360&lt;br /&gt;
* vmguardpages to 2097152:unlimited&lt;br /&gt;
* oomguardpages to 26112:unlimited&lt;br /&gt;
&lt;br /&gt;
== Install additional packages ==&lt;br /&gt;
&lt;br /&gt;
* libstdc++5 (required for installation)&lt;br /&gt;
* pdksh (required for operation?)&lt;br /&gt;
* ssh   (may be required for operation)&lt;br /&gt;
* xbase-clients (for xauth)&lt;br /&gt;
* firefox (for post-installation)&lt;br /&gt;
* strace and telnet (for debugging)&lt;br /&gt;
* libdbi-perl gcc libc6-dev make (for building CPAN DBD::DB2 package)&lt;br /&gt;
&lt;br /&gt;
== Download the DB2 Express-C package ==&lt;br /&gt;
&lt;br /&gt;
DB2 Express-C version 9 is available from this page:&lt;br /&gt;
[[http://www-306.ibm.com/software/data/db2/express/download.html]]&lt;br /&gt;
&lt;br /&gt;
You will need to register with IBM before you can download.&lt;br /&gt;
&lt;br /&gt;
* Untar the received file as root&lt;br /&gt;
* Run exp/disk1/db2setup&lt;br /&gt;
* Follow the prompts:&lt;br /&gt;
** Setup user 'dasusr1'&lt;br /&gt;
** Setup user 'db2inst1' and database instance 'db2inst1'&lt;br /&gt;
&lt;br /&gt;
== Post-install actions ==&lt;br /&gt;
&lt;br /&gt;
This is where it gets yukky. DB2 wants to run a browser inside the VE. It wants to run Java applets inside the browser. I installed Iceweasel, but the post-install script does not recognise it. I was eventually able to hack the script to recognise and use the browser but it crashed on one of the Java applets. I think you can get by without running the post-install.&lt;br /&gt;
&lt;br /&gt;
Here's what to do instead:&lt;br /&gt;
&lt;br /&gt;
First, su to the instance owner:&lt;br /&gt;
&lt;br /&gt;
* su - db2inst1&lt;br /&gt;
&lt;br /&gt;
Try starting and stopping the database:&lt;br /&gt;
&lt;br /&gt;
* db2start&lt;br /&gt;
* db2stop&lt;br /&gt;
&lt;br /&gt;
If these don't work it means your environment variables are not set properly. IBM set these for me:&lt;br /&gt;
&lt;br /&gt;
 CLASSPATH=/home/db2inst1/sqllib/java/db2java.zip:/home/db2inst1/sqllib/java/db2jcc.jar:/home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/function:/home/db2inst1/sqllib/java/db2jcc_license_cu.jar:.&lt;br /&gt;
 DB2INSTANCE=db2inst1&lt;br /&gt;
 PATH=/usr/local/bin:/usr/bin:/bin:/usr/games:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc&lt;br /&gt;
&lt;br /&gt;
Try creating IBM's sample database:&lt;br /&gt;
&lt;br /&gt;
* db2sampl&lt;br /&gt;
&lt;br /&gt;
== Setup a development environment ==&lt;br /&gt;
&lt;br /&gt;
I develop in perl so I was most interested in access to the database though the DBI library. I did this:&lt;br /&gt;
&lt;br /&gt;
* Use CPAN to download and install DBD::DB2&lt;br /&gt;
&lt;br /&gt;
If you don't use CPAN you can also do this (as root):&lt;br /&gt;
&lt;br /&gt;
* Download http://search.cpan.org/CPAN/authors/id/I/IB/IBMTORDB2/DBD-DB2-1.1.tar.gz&lt;br /&gt;
* Untar the file and change into the directory&lt;br /&gt;
* perl Makefile.PL PREFIX=/usr&lt;br /&gt;
* make&lt;br /&gt;
* make test&lt;br /&gt;
* make install&lt;br /&gt;
&lt;br /&gt;
== Setup DB2 for autostart ==&lt;br /&gt;
&lt;br /&gt;
It seems that DB2 can be auto-started at VE boot time, but not auto-stopped. I used this script:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 #&lt;br /&gt;
 # Script to start DB2 instances on bootup.&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 set -e&lt;br /&gt;
 &lt;br /&gt;
 . /lib/lsb/init-functions&lt;br /&gt;
 &lt;br /&gt;
 case &amp;quot;$1&amp;quot; in&lt;br /&gt;
 start)&lt;br /&gt;
         echo Starting DB2&lt;br /&gt;
         /opt/ibm/db2/V9.1/instance/db2istrt&lt;br /&gt;
         ;;&lt;br /&gt;
 stop)&lt;br /&gt;
         ;;&lt;br /&gt;
 restart|reload)&lt;br /&gt;
         ;;&lt;br /&gt;
 esac&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
And I used this command to create the symlink to make it start at VE &amp;quot;boot&amp;quot; time:&lt;br /&gt;
&lt;br /&gt;
 update-rc.d db2 start 95 2 .&lt;br /&gt;
&lt;br /&gt;
== Testing your installation ==&lt;br /&gt;
&lt;br /&gt;
From the db2inst1 user, do:&lt;br /&gt;
&lt;br /&gt;
* db2&lt;br /&gt;
&lt;br /&gt;
Inside the db2 client, try:&lt;br /&gt;
&lt;br /&gt;
 connect to sample&lt;br /&gt;
 grant dbadm on database to user fred&lt;br /&gt;
 connect reset&lt;br /&gt;
&lt;br /&gt;
== Enjoy! ==&lt;br /&gt;
&lt;br /&gt;
Please provide feedback in the discussion (Talk) page about improvements to this HOWTO.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>MaxZinal</name></author>
		
	</entry>
</feed>