Setup LDAP on Ubuntu 10.04

I attempted to set up and LDAP server on Ubuntu, but apparently I skipped a step or missed part of the instructions because I could not get it to work. After researching many websites, I was finally able to come up with a solution that got it to work. All of the instructions are based upon the use of a Linux command prompt (or terminal)

The Steps

  • Connect to your server
  • Enter sudo apt-get purge slapd This will clear your existing slapd configuration if you have one.
  • Enter sudo apt-get install slapd ldap-utils php5-ldap This will re-install slapd with the initial configuration and install ldap-utils and php5-ldap packages if you do not already have them
  • Accept any dependencies necessary.
  • Copy the script located at http://www.blackboxitech.com/it_help/ldap_script.txt to your server. When saving the file, name it ldap_script.sh and save it in a directory that you have access. ( I don't know who initially created it, so I don't know who give credit to)
  • Give the script executable permissions by running the command chmod u+x ldap_script.sh
  • Edit the file look for and edit the following lines:
passwd=pleaseeditme
dc1=pleaseeditme
dc2=pleaseeditme

In my instance, I changed the lines to

passwd=mypassword
dc1=blackbox
dc2=local
  • If you wish, you may change the lines towards the end of the script so that the first user that is added, has all the necessary fields of your choosing. I chose to not modify the fields so that at least one user is added correctly.
  • After you have finished making all of the changes, run the command sudo ./ldap_script You will see the script run and it may prompt you for your password.
  • Enter the command ldapsearch -x -h localhost -b "dc=EXAMPLE,dc=COM" "(objectClass=*)" where EXAMPLE and COM match the entries that you included in the file. You should see the results of your LDAP server.

Information Sources:

http://www.ghacks.net/2010/08/31/set-up-your-ldap-server-on-ubuntu-10-04/

http://pastebin.com/qGk9CzQ9

https://bugs.launchpad.net/ubuntu/+source/openldap/+bug/477257

Published: 2012-02-09
Updated: 2020-07-15
Category: Technology
Read Time: 2 minute(s)