There are several forum threads regarding problems with the installation of OpenLDAP. The main issue that I faced has been the compatibility with Berkley DB libraries. I found in this site that the required version of Berkley DB for compiling OpenLDAP is 4.8. The steps for the installation are described below.
1 2 3 4 5 6 7 |
wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz tar xvzf db-4.8.30.tar.gz cd db-4.8.30 cd build_unix/ ../dist/configure --prefix=$YOUR_APP_FOLDER/berkleydb make make install |
Once the Berkley DB library is installed, we can proceed to install OpenLDAP indicating the correct paths.
1 2 3 4 5 6 7 |
wget ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-2.4.38.tgz tar xvzf openldap-2.4.38.tgz cd openldap-2.4.38 export LD_LIBRARY_PATH=$YOUR_APP_FOLDER/berkleydb/lib/:$LD_LIBRARY_PATH LDFLAGS=-L$YOUR_APP_FOLDER/berkleydb/lib CPPFLAGS="-D_GNU_SOURCE -I$YOUR_APP_FOLDER/berkleydb/include" ./configure --prefix=$YOUR_APP_FOLDER/openldap make depend make install |
Finally, if we want to install also python-ldap library using pip we will find that the installation fails. For solving this issue, we have to indicate where OpenLDAP is located. If we are using a virtual environment (if not, you should!), we have to edit the following lines in the file $YOUR_VIRTUALENV_FOLDER/build/python-ldap/setup.cfg as explained by eikonomega.
1 2 3 |
[_ldap] library_dirs = $YOUR_WEBAPP_FOLDER/openldap/lib /usr/lib64 /usr/lib include_dirs = $YOUR_WEBAPP_FOLDER/openldap/include /usr/include/sasl /usr/include |
I hope you find this post useful. Beware that installation steps may vary depending on your linux server and software versions.