OpenLdap与BerkeleyDB安装过程

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

装的过程当中还遇到很多问题,不过经过Google同窗的帮忙,所有获得解决。下面装安装过程记录以下:java

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 就能经过了。post

 

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 librariesui

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

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)unix

相关文章
相关标签/搜索