26.2. 编译和优化

移动到新的 OpenLDAP 目录,并在终端中输入以下命令

需要注意的是,您可以使用 LDAP 配置三种不同类型的后端数据库。

  1. 一种高性能的、基于磁盘的数据库,名为LDBM

  2. 一个用于任意 UNIX 命令或 shell 脚本的数据库接口,名为SHELL

  3. 一个简单的密码文件数据库,名为PASSWD

  1. OpenLDAP 的默认安装假设一个LDBM后端数据库。因此,如果您想配置另一种类型的后端数据库,则必须在配置和编译时指定它。对于一个SHELL后端数据库,您必须添加--enable-shell选项,对于一个PASSWD后端数据库,用作 NIS 服务的替代,您必须添加--enable-passwd选项在您的配置文件行中。
                       CC="egcs" \
                       CFLAGS="-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions -D_REENTRANT" \
                       ./configure \
                       --prefix=/usr \
                       --libexecdir=/usr/sbin \
                       --localstatedir=/var/run \
                       --sysconfdir=/etc \
                       --enable-dns \
                       --enable-shared \
                       --with-gnu-ld \
                       --disable-debug
                     
    这告诉 OpenLDAP 按照以下方式为特定的硬件设置进行自我配置

    • 启用 dns 支持。

    • 构建共享库。

    • 假设 C 编译器使用 GNU ld。

    Important: 上述编译选项假设您要设置一个LDBM后端数据库。对于另一种类型的后端数据库,您必须在上面的配置文件行中添加所需的选项。

现在,我们必须在服务器中编译和安装 OpenLDAP
                 [root@deep openldap-1.2.10]# make depend
                 [root@deep openldap-1.2.10]# make
                 [root@deep openldap-1.2.10]# cd tests/
                 [root@deep tests]# make
                 [root@deep tests]# cd ..
                 [root@deep openldap-1.2.10]# make install
               

位于/test子目录中的 make 命令将执行一些重要的测试,以在安装之前验证您的 LDAP 服务器的功能。如果某些测试失败,您需要先解决问题,然后才能继续安装。

               [root@deep openldap-1.2.10]# install -d -m 700 /var/ldap
               [root@deep openldap-1.2.10]# echo localhost > /etc/openldap/ldapserver
               [root@deep openldap-1.2.10]# strip /usr/lib/liblber.so.1.0.0
               [root@deep openldap-1.2.10]# strip /usr/lib/libldap.so.1.0.0
               [root@deep openldap-1.2.10]# strip /usr/lib/libldap.a
               [root@deep openldap-1.2.10]# strip /usr/lib/liblber.a
               [root@deep openldap-1.2.10]# strip /usr/sbin/in.xfingerd
               [root@deep openldap-1.2.10]# strip /usr/sbin/go500
               [root@deep openldap-1.2.10]# strip /usr/sbin/go500gw
               [root@deep openldap-1.2.10]# strip /usr/sbin/mail500
               [root@deep openldap-1.2.10]# strip /usr/sbin/rp500
               [root@deep openldap-1.2.10]# strip /usr/sbin/rcpt500
               [root@deep openldap-1.2.10]# strip /usr/sbin/fax500
               [root@deep openldap-1.2.10]# strip /usr/sbin/slapd
               [root@deep openldap-1.2.10]# strip /usr/sbin/slurpd
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldif
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldif2ldbm
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldif2index
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldif2id2entry
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldif2id2children
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldbmcat
               [root@deep openldap-1.2.10]# strip /usr/sbin/ldbmtest
               [root@deep openldap-1.2.10]# strip /usr/sbin/centipede
               [root@deep openldap-1.2.10]# strip /usr/bin/ud
               [root@deep openldap-1.2.10]# strip /usr/bin/ldapadd
               [root@deep openldap-1.2.10]# strip /usr/bin/ldapsearch
               [root@deep openldap-1.2.10]# strip /usr/bin/ldapmodify
               [root@deep openldap-1.2.10]# strip /usr/bin/ldapmodrdn
               [root@deep openldap-1.2.10]# strip /usr/bin/ldappasswd
               [root@deep openldap-1.2.10]# strip /usr/bin/ldapdelete
             

请不要忘记稍后清理
                 [root@deep] /# cd /var/tmp
                 [root@deep ]/tmp# rm -rf openldap-version/ openldap-version.tgz
               
rm 命令将删除我们用于编译和安装 OpenLDAP 的所有源文件。它还将从以下位置删除 OpenLDAP 压缩包/var/tmp目录。