移动到新的 OpenLDAP 目录,并在终端中输入以下命令
需要注意的是,您可以使用 LDAP 配置三种不同类型的后端数据库。
一种高性能的、基于磁盘的数据库,名为LDBM
一个用于任意 UNIX 命令或 shell 脚本的数据库接口,名为SHELL
一个简单的密码文件数据库,名为PASSWD
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 |
启用 dns 支持。
构建共享库。
假设 C 编译器使用 GNU ld。
: 上述编译选项假设您要设置一个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 |
The make depend 命令将构建并为不同的文件创建必要的依赖项,
make 将所有源文件编译为可执行的二进制文件,
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 |
上面的 install 命令将创建一个名为ldap在/var目录下,并将其模式设置为仅对超级用户可读、可写和可执行root, 700以确保安全。
strip 命令将丢弃对象文件中的所有符号。这意味着我们的二进制文件体积会更小。这将提高程序的性能,因为当系统执行二进制文件时,需要读取的行数会更少。
请不要忘记稍后清理
[root@deep] /# cd /var/tmp [root@deep ]/tmp# rm -rf openldap-version/ openldap-version.tgz |