Creating an LDAP Server on Ubuntu

Article by Kristen Grubb (1,930 pts ) , published Oct 27, 2009

Whether you have a small home network or a large corporate network, the Lightweight Directory Access Protocol (LDAP) be used to manage user logins from anywhere in the network. This reduces the need for the users to have credentials on each computer in the network. This article will walk you through setting up OpenLDAP on a Ubuntu server.

Installing the OpenLDAP packages

You will need the slapd and ldap-utils packages in order to create an LDAP server on Ubuntu. The slapd package contains the OpenLDAP server software, while the ldap-utils packages contains utilities and the client software. You can install the packages through the Synaptic package manager or by typing the command "sudo apt-get install slapd ldap-utils." When the slapd package is installed, it will ask you for an administrator password. You can type any password here as you will be asked again later in the process.

The OpenLDAP documentation says that the configuration file for the LDAP server will be found at /etc/ldap/slapd.conf. However, Debian and Ubuntu use a slapd.d directory instead of the slapd.conf file. Therefore, configuring the server is done differently. The information needed for configuration is the administrator password, the domain name for your network, and your company name. There are different ways to provide this information but the easiest way to do it is by typing the command "sudo dpkg-reconfigure slapd."

While the command is running you will be asked a few questions. The first question is whether you want to Omit OpenLDAP server configuration. You will want to answer no to this question. The next three questions will ask you for the domain name, your company name, and the administrator password. You should use the default answers for the final six questions unless you are absolutely sure that you want a non default setting.

That is all that is needed to set up the server. You can test that your server is working correctly by typing the following command:

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

The -x option says to use simple authentication. The -b option says to start at the zero level, instead of the default location. The two dc variables refer to the domain components. Each portion of the domain name must be separated into a component.

Showing page 1 of 2