Tuesday, April 20, 2010

OpenLDAP installation and configuration in Linux

There are so many guides to Install and configure Open LDAP. I have found that there are so many issues coming when people trying to install open LDAP.
I could find out the reason for some issues. Since there is no latest Open LDAP, I just thought of doing this guide as a help for all the students and professional that may need to use LDAP. Specially I describe here about the steps to install and configure Open LDAP.

What is LDAP?

LDAP is the abbreviation for Lightweight Directory Access Protocol. A directory is a specialized database that is optimized for searching purposes, lookups etc. LDAP is designed in an understandable way to avoid the complexity of showing the relationships between relations.
LDAP is an open standard, unlike many other proprietary directory solutions. This Internet standard protocol is used by applications to access information in a directory. It runs directly over TCP, and can be used to access a standalone LDAP directory service or to access a directory service that is back-ended by X.500.

The LDAP directory service model is based on entries. In LDAP, directory entries are arranged in a hierarchical tree-like structure, starting at a root and then branching down into individual entries. At the top level of the hierarchy, entries represent larger organizations. Under these larger organization in the hierarchy might be entries for smaller organizations. The hierarchy might end with entries for individual people or resources.

How it Works :

LDAP is based on a client-server model. LDAP servers make information about people, organizations, and resources accessible to LDAP clients. The LDAP protocol defines operations that clients use to search and update the directory. An LDAP client can perform these operations, among others:

* searching and retrieving entries from the directory
* adding new entries in the directory
* updating entries in the directory
* deleting entries in the directory
* renaming entries in the directory

Resource : http://www.ust.hk/itsc/ldap/understand.html

Things you can do with LDAP :

-Contact Management

-Users and Security

-Image storage

-Document Management

-Store business logic - actual code or SQL statements



Open LDAP Installation and Configurations :
===================================================================================

Common Error :

While installing the latest version of Berkely DB - 4.8.26, error might come saying, [ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1) ]

Which is unable to up the server. But in the LDAP release notes it is stated that the most stable version of Berkely DB for openldap_2.4.21 is db-4.7.25.
So , install this version and reconfigure the LDAP server.

Installing it top of the SSL would be an advantage.

Following are the other steps to do the configuration and Installation :


Installing Berkely db-4.7.25.


Download the compatible version (for your particular LDAP version) of Berkeley DB from http://www.sleepycat.com/download/index.shtml

1. gzip -d db-4.7.25.tar.gz
2. tar xvf db-4.7.25.tar
3. cd db-4.7.25
4. ../dist/configure –prefix=/usr/local/
5. make
6. make install


Installing TSL(I install openSSL)

Download the compatible version of OpenSSL from http://www.openssl.org/source/

1. gzip –d openssl-version.tar.gz
2. tar xfv openssl-version.tar
3. cd openssl-version
4. ./config shared –openssldir=/usr/local
5. make
6. make install


Installating openLDAP

Download the particular version of openLDAP from http://www.openldap.org/software/download/

1. gzip -d openldap-version.tgz
2. tar xfv openldap-version.tar
3. cd openldap-version
4. ./configure
5. make depend
6. make
7. make install


Now we should be able to up and run the LDAP server successfully.

Start the server: /usr/local/libexec/slapd

NOTE: (possible error at this point) :/usr/local/libexec/slapd: error while loading shared libraries: libdb-4.8.so: cannot open shared object file: No such file or directory

If so enter the following command or add it in to bash_profile.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/

Stop the server: kill -INT `cat /usr/local/var/run/slapd.pid`

To check whether the server is correctly configured and running use ldapserch as follows.

ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts

No comments:

Post a Comment