How Do I Configure OpenLDAP to use MySQL (Ubuntu 9.04)?

My intention is to make a MySQL table of Customer Contact Information available to Outlook/Thunderbird clients as an Address Book (via LDAP).

I'm aware that OpenLDAP has a MySQL backend option, but I haven't been able to find any clear, solid documentation on how to configure it.

Which OpenLDAP options do I need to set, and where do I go to set them?

I'm running Ubuntu 9.04.

UPDATE:

I've got the ODBC files setup, and the test data imported to the database, but still no idea how to configure slapd to use the database. Somewhere, in some config file, I have to say "slapd, use the ODBC resource called 'LDAP2MySQL'". But where? And how?

ANOTHER UPDATE:

I'm getting nowhere with this:

The Ubuntu package version didn't have SQL support after all, so I removed it, and I am trying to install from source.

I think it installed ok, but "make test" produces the error "Comparison failed. ./scripts/test003-search failed (exit 1)".

I did a "make install" anyway, since Google didn't seem to have any explanation on how to fix the "comparison failed" problem.

Now I can't even start the stupid thing. "/etc/init.d/slapd start", which worked with Ubuntu's package, doesn't work. The openLDAP manual says "/usr/local/libexec/slapd" is the command to start it. ...But that command produces no output. I don't even know if it's running or not. I give up.

ANOTHER UPDATE:

Ok, I ran "top | grep slapd" and I get nothing, so I guess it's not running. But no error messages. So, what? I have to guess why it won't start?

UPDATE:

I've reinstalled the operating system and am starting from a clean slate. Now I can't even ./configure openldap because it can't find db.h. The package "db4.7-util" is installed. The harder I try to make this work, the less it works. I can't believe that no one knows how to do this.

UPDATE:

I just installed BerkeleyDB from source, and yet the OpenLDAP compiler still says:

    checking for db.h... no
    configure: error: BDB/HDB: BerkeleyDB not available

One site sugguested I try:

    export CPPFLAGS="-I/usr/local/berkeleydb/include"
   export LDFLAGS="-L/usr/local/berkeleydb/lib"

But that didn't work either.

UPDATE:

OK. I FINALLY got it to compile.

I had to use:

CPPFLAGS="-I/usr/local/berkeleydb/include -D_GNU_SOURCE" export CPPFLAGS

LDFLAGS="-L/usr/local/lib -L/usr/local/berkeleydb/lib -R/usr/local/berkeleydb/lib" export LDFLAGS

LD_LIBRARY_PATH="/usr/local/berkeleydb/lib" export LD_LIBRARY_PATH

./configure --enable-sql 

Now I'm facing another problem. When I run "make test", it hangs forever on:

>>>>> Starting test001-slapadd ...
running defines.sh
Running slapadd to build slapd database...

Apparently I'm supposed to install two patches to fix this, but haven't been having much luck. I think I found one of them, but I have no idea how to apply it.


Solution 1:

The OpenLDAP Admin Guide seems to walk through the setup in a pretty clear fashion. And man 5 slapd-sql appears to be thorough and complete.