This article will show you how to setup an LDAP address book using OpenLDAP, an open source implementation of the Lightweight Directory Access Protocol.

Installing OpenLDAP

The command line equivalent of the steps below is yum install openldap-servers openldap-clients.

Package Manager1. Click Applications then click Add/Remove Software. This will launch the Package Manager window.
Package Manager Search2. Click the Search tab. Next type in openldap and click the Search button.
Package Manager Search3. Select the latest version of openldap-servers and openldap-clients then click Apply. Next click on Continue until it proceeds with the installation.
Package Manager4. After installation, click Ok. You now have successfully installed the OpenLDAP servers and clients.

Configuring OpenLDAP

The example below uses acme.local as the base domain.

Edit slapd.conf
1. Edit the file /etc/openldap/slapd.conf.
suffix "dc=acme,dc=local"
rootdn "cn=manager,dc=acme,dc=local"
rootpw password

NoteTo avoid storing the password in plain-text, convert the password to a hash by using the command slappasswd -s password and paste the resulting hash into the file.

File Browser2. Copy the file /etc/openldap/DB_CONFIG.example and put it into /var/lib/ldap as DB_CONFIG.
Service Configuration3. Start the ldap service. Learn how to start services here.
4. Create a file named base.ldif containing the lines below and save it into your home directory.
dn: dc=acme,dc=local
dc: acme
objectClass: domain
Terminal5. Import base.ldif into your directory using the command below.
ldapadd -x -D "cn=manager,dc=acme,dc=local" -w password -f ~/base.ldif

Replace password with the root password you specified in slapd.conf.

To populate your directory, create a file similar to the one below and import it using ldapadd or better yet, use a GUI tool like JXplorer, a Java based LDAP browser.

dn: ou=People,dc=acme,dc=local
ou: People
objectClass: organizationalUnit

dn: uid=bugsbunny,ou=People,dc=acme,dc=local
uid: bugsbunny
cn: Bugs Bunny
displayName: Bugs Bunny
givenName: Bugs
sn: Bunny
objectClass: inetOrgPerson
userPassword: password
mail: bugsbunny@acme.local

The displayName attribute is required for Outlook addressbook users.

Related Pages

Visit the forum to ask for help or to give a comment.

Posted on 4/19/2008 and last updated on 11/7/2009
Filed under CentOS 5 , LDAP , Red Hat Enterprise Linux 5