Compile and install OpenLDAP in CentOS 6.4
Environment:
CentOS 6.4X64
Db-4.6.21.tar.gz
Openldap-2.4.36.tgz
Phpldapadmin-1.2.3.zip
Package download
1. Install BerkeleyDB
# Tar zxvf db-4.6.21.tar.gz
# Cd db-4.6.21/build_unix
# ../Dist/configure
# Make
# Make install
# Vi/etc/ld. so. conf Add the following sentence
/Usr/local/BerkeleyDB.4.6/lib
# Ldconfig
Ii. Install openLDAP
# Tar zxvf openldap-2.4.36.tgz
# Openldap-2.4.36
# Env CPPFLAGS = "-I/usr/local/BerkeleyDB.4.6/include" LDFLAGS = "-L/usr/local/BerkeleyDB.4.6/lib-D_GNU_SOURCE ". /configure -- prefix =/usr/local/openldap -- enable-ldbm
Note: you need to set the include and lib paths for the database. Otherwise, the DB version is not compatible and is interrupted when the database is configured. If the -- enable-ldbm option is not available
During the test directory, ldbm cannot be found.
# Make depend
# Make
# Make test
# Make install
3. Configure LDAP
# Vi/usr/local/openldap/etc/openldap/slapd. conf
Modify suffix rootdn and so on, that is, define your own domain name
// Create initialization data
# Vi base. ldif Input
Dn: dc = vqiu, dc = cn
Objectclass: dcObject
Objectclass: organization
O: ant, precision.
Dc: vqiu
Dn: cn = admin, dc = vqiu, dc = cn
Objectclass: organizationalRole
Cn: admin
// Import the initial data
#/Usr/local/openldap/bin/ldapadd-x-W-D "cn = admin, dc = vqiu, dc = cn-f base. ldif
// Start the service
#/Usr/local/openldap/libexec/slapd-d 256-4
4. Build an http Platform
# Yum-y install httpd-devel php-mysql php-ldap
Configure phpldapadmin
# Tar-zxvf phpldapadmin-1.2.3.tgz
# Music phpldapadmin-1.2.3/var/www/html/
# Cd/var/www/html
# Mv phpldapadmin-1.2.3 phpldapadmin
# Cd phpldapadmin/config
# Cp config. php. example config. php
# Vi config. php
$ Servers-> newServer ('ldap _ pla ');
$ Servers-> setValue ('server', 'name', 'hdt Linux LDAP ');
$ Servers-> setValue ('server', 'host', '2017. 0.0.1 ');
$ Servers-> setValue ('server', 'Port', 389 );
$ Servers-> setValue ('server', 'base', array ('DC = abc, dc = com '));
$ Servers-> setValue ('login', 'auth _ type', 'cooker ');
$ Servers-> setValue ('login', 'Bind _ id', 'cn = root, dc = abc, dc = com ');
$ Servers-> setValue ('login', 'Bind _ pass', '123 ');
$ Servers-> setValue ('server', 'tls ', false );
Test query:
Ldapsearch-x-B '-s base' (objectclass = *) 'namingcontexts
On windows, you can use the LDAP admin Tool to remotely and conveniently.