Tuesday, March 9, 2010

OpenLDAP installation and configuration.

In the openLDAP installation and configuration README I followed they were asked to install the latest version of Berkely DB. At the moment I was installing it was 4.8.26 but after installing it I was unable to up the server. [ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1) ] error was appeared. Finally I found the reason and it worked for me. 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. Then I install this version and reconfigure the LDAP server. It worked fine. Here are the full steps that I have followed. I installed it on top of the SSL.


Installing Berkely db-4.7.25.

Download the compatible version (for your particular LDAP version) of Berkeley DB f rom 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/

gzip -d openldap-version.tgz

    1. tar xfv openldap-version.tar

    2. cd openldap-version

    3. ./configure

    4. make depend

    5. make

    6. 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 sharedlibraries: libdb-4.8.so: cannot open shared object file: No such file or directory

If so enter the following command or add it 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