Here is an updated tutorial on installing OpenLDAP server on your box. These instructions were done on Debian 6 Squeeze

apt-get install slapd ldap-utils libldap-2.4-2 libldap-2.4-2-dbg libldap2-dev libnet-ldap-perl libnss-ldap libpam-ldap phpldapadmin

Configure slapd – Enter the Administrator password to use
Configure libnss-ldap – Enter the ldap server URI – the hostname to connect to the server
This should be localhost so…ldap://
-Enter Distinguished Name of the search base..This is the domain part of ldap
So something like “dc=example,dc=com” would be your DN
-LDAP version to use – Use the latest, ver 3
-Admin account to use? This should be something like “cn=admin,dc=example,dc=com”
-LDAP root account password – The password for the cn=admin admin acct for ldap, should be same as Administrator password for ldap above.
-A message reminding you to edit the nsswitch.conf file in /etc to add in ldap so it is seen by the system as another way to auth users.

Configure libpam-ldap – Allow LDAP admin acct to behave like local root?
Answer Yes to this..
-Does LDAP db require login to retrieve entries?
This can be answered No..
-Enter the LDAP Admin acct.
Enter in the “cn=admin,dc=example,dc=com” that you used for administrative account above.
-LDAP Admin password for PAM
Enter in your admin password

dpkg-reconfigure slapd

Configure slapd – Omit OpenLDAP server conf?
-DNS Domain Name to construct DN
-Organization Name?
-Admin Password – type and confirm
-Database backend to use…Go ahead with HDB, the better of the two.
-Remove db when slapd is purged?
I would say yes to this as long as you have backed up first, really up to you.
-Move old db?
-Should OpenLDAP allow v2?

To check that the ldap server is running, you can view the entries inside:

ldapsearch -x -b dc=example,dc=com

This should enable you to have a fully functioning LDAP database. You can now use and log into your ldap database (given you have installed apache)!

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.