How to configure OpenLDAP 2.4 with bdb backend

configurationopenldap

It seems like OpenLDAP will prefer to using slapd-config(5) instead of slapd.conf(5).
But I don't know how to start with slapd-config(5) because I don't know how to set a root password for it.

So I'm back using slapd.conf(5), with the following /etc/ldap/slapd.conf:

database bdb
suffix "dc=mycompany,dc=net"
rootdn "cn=root,dc=mycompany,dc=net"
rootpw secret
directory /var/lib/ldap

And alternate the /etc/default/slapd to use /etc/ldap/slapd.conf instead of /etc/ldap/slapd.d. However, it can't start then:

sudo /etc/init.d/slapd restart
Stopping OpenLDAP: slapd.
Starting OpenLDAP: slapd - failed: 
Unrecognized database type (bdb)

But, I found their is a bdb backend:

$ ls -al /usr/lib/ldap/*bdb*
lrwxrwxrwx 1 root     21 2010-12-02 18:50 back_bdb-2.4.so.2 -> back_bdb-2.4.so.2.5.6
-rw-r--r-- 1 root 182560 2010-11-20 02:29 back_bdb-2.4.so.2.5.6
-rw-r--r-- 1 root   1106 2010-11-20 02:28 back_bdb.la
lrwxrwxrwx 1 root     21 2010-12-02 18:50 back_bdb.so -> back_bdb-2.4.so.2.5.6

Best Answer

It looks like you haven't loaded this module. Uncomment/insert the belows line to slapd.conf:

modulepath /usr/lib/ldap
moduleload back_bdb.la