Platform and software version:
OS:CentOS5.3
gcc:4.1.2
BerkeleyDB:4.8.24
openldap:2.4.19
1. Prerequisite software
GCC
BerkeleyDB
openssl(installed by default)
2.Q&A
(1)不装GCC,执行./configure时,
出现错误:
configure: error: Unable to locate cc(1) or suitable replacement. Check PATH or set CC.
解决方法:
install gcc
[root@localhost openldap-2.4.19]#yum -y install gcc
(2)不装BerkeleyDB,执行./configure时,
出现错误:
configure: error: BDB/HDB: BerkeleyDB not available
解决方法:
[root@localhost BerkeleyDB]# unzip db-4.8.24.zip
[root@localhost BerkeleyDB]# cd db-4.8.24
[root@localhost db-4.8.24]# cd build_unix/
[root@localhost db-4.8.24]# ../dist/configure
[root@localhost db-4.8.24]# make
[root@localhost db-4.8.24]# make install
[root@localhost openldap-2.4.19]#export CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include"
[root@localhost openldap-2.4.19]#export LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.8/lib -L/usr/local/BerkeleyDB.4.8/lib"
[root@localhost openldap-2.4.19]#export LD_LIBRARY_PATH="/usr/local/BerkeleyDB.4.8/lib"
[root@localhost openldap-2.4.19]#cp /usr/local/BerkeleyDB.4.8/lib/* /usr/lib
[root@localhost openldap-2.4.19]#cp /usr/local/BerkeleyDB.4.8/include/* /usr/include
注意:如不按照以上步骤可能会报如下错误:
configure: error: Berkeley DB version mismatch
3.install openldap
[root@localhost openldap-2.4.19]#./configure --prefix=/usr --libexecdir=/usr/sbin --localstatedir=/var/run --sysconfdir=/etc --enable-shared --with-gnu-ld
[root@localhost openldap-2.4.19]#make depend
[root@localhost openldap-2.4.19]#make
[root@localhost openldap-2.4.19]#make test
[root@localhost openldap-2.4.19]#make install
4. 支持ssl
如果要支持ssl,需要安装cyrus-sasl-2.1.22.tar.gz,下载:
http://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-2.1.22.tar.gz
[root@localhost cyrus-sasl-2.1.22]#./configure --prefix=/usr --sysconfdir=/etc --with-saslauthd=/var/run/saslauthd --disable-digest --with-bdb-libdir=/usr/local/BerkeleyDB.4.8/lib --with-bdb-incdir=/usr/local/BerkeleyDB.4.8/include
[root@localhost cyrus-sasl-2.1.22]#make
[root@localhost cyrus-sasl-2.1.22]#make install
然后,再用以下参数编译openldap
[root@localhost openldap-2.4.19]#./configure --prefix=/usr --libexecdir=/usr/sbin --localstatedir=/var/run --sysconfdir=/etc --enable-shared --with-gnu-ld --with-tls --with-cyrus-sasl