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
confirm
Configure libnss-ldap – Enter the ldap server URI – the hostname to connect to the server
This should be localhost so…ldap://127.0.0.1
-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?
No
-DNS Domain Name to construct DN
example.com
-Organization Name?
example.com
-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?
Yes
-Should OpenLDAP allow v2?
No

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 http://example.com/phpldapadmin 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.