系统:RHEL 5.5 x64

软件: db-5.3.21.gz openldap-2.4.31.tgz

1、检查相应的依赖包:
[root@localhost ~]# rpm -qa | grep gcc
compat-libgcc-296-2.96-138
libgcc-4.1.2-48.el5
gcc-4.1.2-48.el5
gcc-gfortran-4.1.2-48.el5
libgcc-4.1.2-48.el5
gcc-c++-4.1.2-48.el5

[root@localhost ~]# rpm -qa | grep sasl
cyrus-sasl-lib-2.1.22-5.el5_4.3
cyrus-sasl-plain-2.1.22-5.el5_4.3
cyrus-sasl-devel-2.1.22-5.el5_4.3
cyrus-sasl-devel-2.1.22-5.el5_4.3
cyrus-sasl-lib-2.1.22-5.el5_4.3
cyrus-sasl-plain-2.1.22-5.el5_4.3
cyrus-sasl-2.1.22-5.el5_4.3

[root@localhost ~]# rpm -qa | grep ssl
openssl-0.9.8e-12.el5_4.6
openssl-devel-0.9.8e-12.el5_4.6
openssl-0.9.8e-12.el5_4.6
openssl-devel-0.9.8e-12.el5_4.6

以上基本满足条件。

2、安装DBD数据库
[root@localhost ~]# tar -xzf db-5.3.21.gz
[root@localhost ~]# cd db-5.3.21
[root@localhost db-5.3.21]# cd build_unix/
[root@localhost db-5.3.21]# ./dist/configure --prefix=/usr/local/berkeleydb5.3
[root@localhost db-5.3.21]# make && make install
[root@localhost db-5.3.21]# echo "/usr/local/berkeleydb5.3/lib" >> /etc/ld.so.conf
[root@localhost db-5.3.21]# ldconfig
[root@localhost db-5.3.21]# cd

3、安装openldap
[root@localhost ~]# tar -xzf openldap-2.4.31.tgz
[root@localhost ~]# cd openldap-2.4.31
[root@localhost openldap-2.4.31]# CPPFLAGS="-I/usr/local/berkeleydb5.3/include" LDFLAGS="-L/usr/local/berkeleydb5.3/lib"  ./configure --prefix=/usr/local/openldap --enable-wrappers
Making servers/slapd/backends.c
    Add config ...
    Add ldif ...
    Add monitor ...
    Add bdb ...
    Add hdb ...
    Add mdb ...
    Add relay ...
Making servers/slapd/overlays/statover.c
    Add syncprov ...
Please run "make depend" to build dependencies

[root@localhost openldap-2.4.31]# make depend
[root@localhost openldap-2.4.31]# make
[root@localhost openldap-2.4.31]# make install

至此,openldap已经安装完毕