OpenLdap与BerkeleyDB安装过程

前段时间在看LDAP方面的东西,最近重装了Ubuntu之后开始在自己的机器上装一个OpenLDAP。

装的过程中还遇到不少问题,不过通过Google同学的帮忙,全部得到解决。下面装安装过程记录如下:

Berkeley DB 安装需要注意的地方
今天在装OpenLdap,结果要求先装上Berkeley DB,于是就先装BDB了。
按照Linux下安装软件三部曲,进行安装,但是在执行第一步configure时就报出下面这个错误:

 Berkeley DB should not be built in the top-level or dist directories.

加上-prefix=/usr/local/BerkeleyDB之后问题同样存在,于是到网上去找了一个解决方案。具体方法如下:
# tar xvfz db-4.4.16.tar.gz
# cd db-4.4.16/build_unix/
# ../dist/configure -prefix=/usr/local/BerkeleyDB
# make
# sudo make install  

BerkeleyDB安装完毕之后继续安装OpenLdap,但是configure时又出如下问题:
configure: error: BDB/HDB: BerkeleyDB not available

BerkeleyDB已经安装好了,为什么仍然出现这个错误呢? 继续Google,发现解决方法如下:
$export CPPFLAGS="-I/usr/local/BerkeleyDB/include"
$export LDFLAGS="-L/usr/local/BerkeleyDB/lib"

需要注意的是上面两个命令需要以root身份执行。
执行完之后,继续configurate,这次还是有错,这次错误变成了:
configure: error: Berkeley DB version mismatch

增加下面一行之后,安装正确.
export LD_LIBRARY_PATH="/usr/local/BerkeleyDB/lib"

 

今天重装Openldap再次遇到问题,通过Google找到一位兄弟的解决方案,特地补充进来,希望对于其它遇到相同问题朋友有用。
使用berkeleydb 4.7作为后端数据库时,安装Openldap过程中make这个过程会出现如下错误:
/bin/sh ../../..//libtool --tag=disable-shared --mode=compile cc -g -O2 -I../../../include        -I../../../include -I.. -I./..  -I/ceno/lab/berkeleydb/include    -c init.c
 cc -g -O2 -I../../../include -I../../../include -I.. -I./.. -I/ceno/lab/berkeleydb/include -c init.c -o init.o
init.c: In function `bdb_db_open':
init.c:509: structure has no member named `lk_handle'
init.c: In function `bdb_back_initialize':
init.c:752: warning: passing arg 1 of `db_env_set_func_yield' from incompatible pointer type
make[3]: *** [init.lo] Error 1
make[3]: Leaving directory `/work/ceno/lab/openldap-2.4.11/servers/slapd/back-bdb'
make[2]: *** [.backend] Error 1
make[2]: Leaving directory `/work/ceno/lab/openldap-2.4.11/servers/slapd'
make[1]: *** [all-common] Error 1
make[1]: Leaving directory `/work/ceno/lab/openldap-2.4.11/servers'
make: *** [all-common] Error 1

现在的邮件列表是一个解决方法,不过这不是官方给出的解决方法,可能会在使用过程中引起其它问题:
http://www.openldap.org/lists/openldap-bugs/200805/msg00154.html


上述错误具体原因应该是berkeleydb 4.7中已经没有了lk_handle这个structure,而在Openldap中没有更新,导致该问题。
具体方法如下:
cd openldap-2.4.11/servers/slapd/back-bdb/
将init.c 和 cache.c中 

#if DB_VERSION_FULL >= 0x04060012
改为
#if 0 && DB_VERSION_FULL >= 0x04060012
之后再make 就能通过了。

 

Openldap安装指南:http://www.openldap.org/doc/admin24/install.html
 
update 2009/03/13
今天查了些资料,把在安装过程中设置的几个参数搞明白了。
CPPFLAGS,LD_LIBRARY_PATH,LDFLAGS等参数需要在configure时指定,该参数会影响生成的Makefile文件。各参数的具体意义如下:
 
CPPFLAGS    C/C++预处理器的命令行参数。
LDFLAGS     链接器的命令行参数。
 
LD_LIBRARY_PATH等PATH的意义如下:
 

CLASSPATH = specifies where the computer searches for java class libraries

LD_LIBRARY_PATH = specifies where the computer looks for dynamically-loaded libraries

PATH = specifies where the computer looks for executables

LIBPATH = also specifies where the computer looks for dynamically-loaded libraries (usually set just in case something doesn't support LD_LIBRARY_PATH)

posted @ 2017-10-22 19:15  邱明成  阅读(4877)  评论(0编辑  收藏  举报