This recipe covers the installation and initial configuration of LDAP. The Ubuntu package repository makes the installation easy by providing the required packages for the LDAP service.
Let's start with installing the LDAP package and helper utilities:
apt-get update
command and then install the OpenLDAP package, slapd
:$ sudo apt-get update $ sudo apt-get install slapd ldap-utils
slapd
package. Use the following command to start the re-configuration process:$ sudo dpkg-reconfigure slapd
NO
.example.com
. This domain name will determine the top structure of your directory:example
as my organization.HDB
slapd
is purged - this is about removing the database in case you uninstall the slapd
package. Choose NO
as you don't want the database to be deleted:NO
:ldapsearch -x
command. You should see output similar to following screenshot:ldapsearch
as follows to query our newly added domain, example.com
:$ ldapsearch -x -LLL -H ldap:/// -b dc=example,dc=com dn
example.com
:$ ldapsearch -x -LLL -b dc=example,dc=com
The ldap-utils
package also provides more commands to configure the LDAP service, but it is quite a lengthy and complex task. In the next recipe, we will learn how to set up a web-based admin interface that make things a little easier.
With the respective packages available in the Ubuntu package repository, installing OpenLDAP is quite an easy task. All we have to do is install the required binaries and then configure the LDAP system to serve our desired domain. We have installed two packages: one is slapd
, the LDAP daemon, and the other is ldap-utils
, which provides various commands to work with the LDAP daemon. After installation is complete, we have re-configured LDAP to match our required directory setup. We have chosen to go with LDAPv3 API and disabled LDAPv2. If you have any older systems working with LDAPv2, then you will need to enable support for old APIs.
man ldap.conf
command.