Building OpenLDAP on Linux

Posted by Unknown on

Since OpenLDAP is a native, non - java based package it takes some effort to build this on host operating system, before you build OpenLDAP we need to build all it's dependencies on the host OS.

I have tested this build on Oracle Linux, since Oracle Linux is a flavour or Cent OS and Redhat, these steps should work fine on Oracle, CentOS and Redhat Linux.

Step 1: Download following Prerequisites for OpenLDAP


It is very important that you download only the supported version of the dependencies for your version of OpenLDAP
Review this link before you download all dependent software.
http://www.openldap.org/doc/admin24/appendix-recommended-versions.html

NOTE: The build will break if you try to build OpenLDAP with Latest versions of dependent software

Dependency 1: Install BerkleyDB
------------------------------------------
Open LDAP uses Oracle BerkeleyDB as backend, download this from Oracle Site:

http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html
tar xvzf db-5.1.29.tar.gz
mv db-5.1.29 berkley

cd berkley/build_unix
../dist/configure
make
sudo make install
NOTE: Make a note of installed location of BerkleyDB, you will notice it in the output of this command

E.g.
...
...
Libraries have been installed in:
   /usr/local/BerkeleyDB.5.1/lib
...

...


NOTE: Use following steps to re-build
make realclean
../dist/configure
make
To uninstall:
make uninstall

Dependency 2: Install OpenSSL
-----------------------------------------
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz

Step 1: Download Software:
wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.34.tgz
 $ ./configure
 $ make
 $ make test
 $ make install

This will install openssl at following location

/usr/local/ssl

Dependency 3: GnuTLS Transport Layer Security Library
-------------------------------------------------------------------------

wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.0.tar.gz
wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.2.2.tar.bz2
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v2.0/gnutls-2.0.1.tar.bz2


$ tar xvzf libgpg-error-1.0.tar.gz
$ cd libgpg-error-1.0
$ ./configure
$ make
$ sudo make install


$ tar jxf libgcrypt-1.2.2.tar.bz2
$ cd libgcrypt-1.2.2
$ ./configure
$ make
$ sudo make install

$ tar jxf gnutls-2.0.1.tar.bz2
$ cd  gnutls-2.0.1
$ ./configure
$ make
$ sudo make install

Dependency 4: TCP Wrappers
--------------------------------------

 $ sudo yum install tcp_wrappers*

Step 2: Install OpenLDAP

$ tar xvzf openldap-2.4.34.tgz
$ mv openldap-2.4.34 openldap-2389$ cd openldap-2389
 ./configure --enable-wrappers CPPFLAGS="-I/usr/local/BerkeleyDB.5.1/include" LDFLAGS="-L/usr/local/lib -L/home/wasuser/berkley/build_unix/.libs -R/home/wasuser/berkley/build_unix/.libs"

If you notice similar error ensure you are pointing to the correct path of berkley, n the example above I have berkley DB at /wasuser/berkley/

Configuring OpenLDAP 2.4.34-Release ...
..
..
configure: error: BDB/HDB: BerkeleyDB not available

 checking for Berkeley DB major version in db.h... 5
checking for Berkeley DB minor version in db.h... 1
checking if Berkeley DB version supported by BDB/HDB backends... yes
checking for Berkeley DB link (-ldb-5.1)... yes
checking for Berkeley DB library and header version match... no
configure: error: Berkeley DB version mismatch

$ make depend
$ make
$ make test
$ sudo make install

With this you should be all set with OpenLDAP install, try to start and stop ldap instance to ensure it is working properly.


2 comments: