Berkeley DB, CentOS 4.4 and Xen/Amazon EC2

I am trying to get a CentOS 4.4 image running on Amazon EC2, and hit a helluva bug.  A time consuming bug at least…  CentOS comes with Berkeley db4 compiled with ‘–enable-posixmutexes’.  But this doesn’t work under Xen.  When installing the perl BerleleyDB package I get a bunch of this:

Berkeley DB library configured to support only DB_PRIVATE environments

The BerkeleyDB README mentions this Red Hat bug.  So I compiled my own copy of db-4.4.20 with ‘–disable-posixmutexes’ and installed it to /usr/local/BerkeleyDB.4.4 and linked it from /usr/local/BerkeleyDB.  Then while installing perl BerkeleyDB, I started getting a bunch of this crap:

Can't load '/var/tmp/BerkeleyDB-0.31/blib/arch/auto/BerkeleyDB/BerkeleyDB.so' for
module BerkeleyDB: libdb-4.4.so: cannot open shared object file: No such file or
directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.

I was stuck at this point for a while, then a google search for "libdb-4.4.so: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230." (no quotes) turned up exactly one match – this site.

So the entire solution is:

  tar -zxvf db-4.4.20.tar.gz
  cd db-4.4.20/build_unix/
  ../dist/configure --disable-posixmutexes
  make
  make install
  cd /usr/local
  ln -s BerkeleyDB.4.4 BerkeleyDB
  echo "/usr/local/BerkeleyDB/lib" > /etc/ld.so.conf.d/BerkeleyDB.conf
  /sbin/ldconfig

  FTP_PASSIVE=1 LANG=en_US LC_CTYPE=en_US perl -MCPAN -e shell
  >  install BerkeleyDB

One thought on “Berkeley DB, CentOS 4.4 and Xen/Amazon EC2

Leave a Reply

Your email address will not be published. Required fields are marked *