Since OS X comes with OpenLDAP already installed, you really might not need to do this, but I wanted to get to know the software better and was looking for a way to get a "standard" ldap service running on an OS X server (the idea being to avoid mucking up the OpenDirectory configuration by staying out of it's way). I'm just getting started with this myself, so be careful! Also, this is a plain vanilla installation of ldap, with minimal options.
This procedure is mainly derived from 4AM-Media's FAQ entry on installing OpenLDAP, many thanks to Michael Bartosh for putting up the basic information. This installation puts a copy of OpenLDAP in /usr/local.
Finally, before starting you should take a look at the OpenLDAP Admin guide, this will make more sense if you look through that a bit.
It seems that typically OpenLDAP uses the Berkeley database as the backend, at the time of this writing db-4.2.52 is the current version. You can download it via safari or other browser from Sleepy Cat, also make sure to get the patches.
cd /Installers/db-4.2.52
gilgamesh:/Installers/db-4.2.52.NC$ patch -p0 < patch.4.2.52.1 patching file mp/mp_fget.c patching file mp/mp_fput.c gilgamesh:/Installers/db-4.2.52.NC$ patch -p0 < patch.4.2.52.2 patching file lock/lock.c
cd db-4.1.25/build_unix
../dist/configure
make
sudo make install
open /usr/local/lib/If the directory exists, it will open in Finder. If not, you'll get an error in the terminal telling you there's no such directory. In this latter case, you'll want to create these directories, so you can soft link the Berkeley DB include and lib files to those locations.
sudo mkdir Ðp /usr/local/include sudo mkdir Ðp /usr/local/lib
sudo ln -s /usr/local/BerkeleyDB.4.1/include/* /usr/local/include sudo ln -s /usr/local/BerkeleyDB.4.1/lib/* /usr/local/lib
Ok, now the Berkeley DB is installed, on to the OpenLDAP.
I downloaded openldap-2.1.30 via safari from the OpenLDAP site, and double clicked to unpack the tarred files.
cd /Installers/openldap-2.1.30
ld: Undefined symbols: _res_9_dn_expand _res_9_query make[2]: *** [dntest] Error 1 make[1]: *** [all-common] Error 1 make: *** [all-common] Error 1Evidently, this is due to Apple changing the ways they use bind, so to configure the build try this command:
env LIBS="-lresolv" ./configure(For more info on this issue, see this (albeit cryptic) thread (but the patches referenced are no longer necessary, since they were rolled into the distro).
env LIBS="-Lresolv" CPPFLAGS="-I/usr/local/BerkeleyDB.4.2/include" \ LDFLAGS="-L/usr/local/BerkeleyDB.4.2/lib" ./configure(Thanks to David Cole for this tip)
make depend
make
make test
sudo make install
The next step is to edit /usr/local/etc/openldap/slapd.conf to suit your initial needs. The file itself is well commented, and the defaults for most settings work fine.
Once you've gotten a basic slapd.conf file set up, you'll want to try to test it by running slapd in test mode:
sudo /usr/local/libexec/slapd -tI'm using the phpldapadmin software to play with the base configuration.....