安装OpenLdap需要BerkeleyDB的支持,否则configure时会报 如下错误:
configure: error: BDB/HDB: BerkeleyDB not available
tar xvfz db-4.6.21.tar.gz cd db-4.6.21/build_unix/ ../dist/configure -prefix=/usr/local/BerkeleyDB make make install
vi /etc/profile export CPPFLAGS="-I/usr/local/BerkeleyDB/include" export LDFLAGS="-L/usr/local/BerkeleyDB/lib"
wq保存后退出,使环境变量生效
source /etc/profile
cp /usr/local/BerkeleyDB/lib/* /usr/lib cp /usr/local/BerkeleyDB/include/* /usr/include
注意:如不按照以上步骤可能会报如下错误:
configure: error: Berkeley DB version mismatch
tar zvxf openldap2.4.29.tgz cd /openldap2.4.29 ./configure --prefix=/usr/local/openldap make depend make make test make install
注意: 在执行./configure的时候可能会报如下错误
configure: error: MozNSS not found – please specify the location to the NSPR and NSS header files in CPPFLAGS and the location to the NSPR and NSS libraries in LDFLAGS (if not in the system location)
原因是openldap需要依赖openssl的一些库文件,安装openldap,然后配置SSL的环境变量
export CPPFLAGS="-I/usr/local/BerkeleyDB/include -I/usr/local/ssl/include "
export LDFLAGS="-L/usr/local/BerkeleyDB/lib -L/usr/local/ssl/lib "