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
It looks like you haven't loaded this module. Uncomment/insert the belows line to
slapd.conf
:I recently helped my coworker do the same thing, and this is what i found to be the quick and easy solution (on a clean install) using the new configuration backend. This was on a RHEL server, but it should be similar on whatever you are running.
Stop slapd and check what your configuration db admin dn + password is
If olcRootPW is not present in the file add it, and start slapd again. You'll need some ldif to create your new bdb database
And just insert that with ldapadd using your admin dn + password
You can change configuration in the slapd.d files just like you would do with slapd.conf, even though it is not recomended.