前段時間在看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
CPPFLAGS C/C++預處理器的命令行參數。 LDFLAGS 連接器的命令行參數。
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