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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM