一、安装Berkeley DB
1、下载 http://www.oracle.com/technetwork/database/berkeleydb/overview/index.html
2、安装
# tar xvf db-6.0.20.tar.gz
# cd db-6.0.20
# cd build_unix/
#../dist/configure -prefix=/usr/local/berkeleyDB
# make
# make install
二、安装 openldap
1、下载 http://www.openldap.org/software/download
2、安装
# gunzip -c openldap-2.4.35.tgz | tar xvfB -# cd openldap-2.4.35
# gunzip -c openldap-2.4.35.tgz | tar xvfB -
# cd openldap-2.4.35
# ./configure --prefix=/usr/local/openldap
编译出错:
1)BerkeleyDB version incompatible
解决方法一:设置环境变量
export CPPFLAGS="-I/usr/local/berkeleyDB/include"
export LDFLAGS="-L/usr/local/berkeleyDB/lib"
解决方法二:加入共享库所在位置
echo "/usr/local/berkeleyDB/lib" >> /etc/ld.so.conf
/sbin/ldconfig
2)Berkeley DB version mismatch
解决方法:
export LD_LIBRARY_PATH="/usr/local/berkeleyDB/lib/"
# make depend
# make
# make install
# cp /usr/local/openldap/var/openldap-data/DB_CONFIG.example /usr/local/openldap/var/openldap-data/DB_CONFIG
三、测试启动
# /usr/local/openldap/libexec/slapd -d 256
四、启动
# /usr/local/openldap/libexec/slapd
# netstat -tunlp |grep :389
五、查看能否正常查询
# /usr/local/openldap/bin/ldapsearch -x -b '' -s base '(objectclass=*)'
六、关闭
#kill -INT `cat /usr/local/openldap/var/run/slapd.pid`