Download OpenLDAP 2.4.16 from http://www.openldap.org/
Before check the pre-requisities like Berkeley DB 4.5, openssl etc…
You can download Berkeley DB from http://www.oracle.com/technology/software/products/berkeley-db/db/index.html
For installing Berkeley DB see the docs directory index.html
(cd build_unix; ../dist/configure; make ; make install)
Set environment variables: -
Set environment variables: -
export CPPFLAGS="-I/usr/local/BerkeleyDB.4.5/include"
export LDFLAGS="-L/usr/local/BerkeleyDB.4.5/lib"
export LD_LIBRARY_PATH=/usr/local/BerkeleyDB.4.5/lib
export LDFLAGS="-L/usr/local/BerkeleyDB.4.5/lib"
export LD_LIBRARY_PATH=/usr/local/BerkeleyDB.4.5/lib
(if you are not setting the enviornment variables you may get an error "Berkeley DB version mismatch".. see the FAQ link)
OpenLDAP Installation
untar the package
% tar –xvf openldap-2.4.16.tar.gz
% cd openldap-2.4.16
% ./configure
% make depend
% make
% make test
% su root –c ‘make install’
That’s it.. if there is no error Enjoy!
Copy libdb to /usr/lib/.
# cp /usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so /usr/lib/
reset rootpw.
#/usr/local/sbin/slappasswd (reset password)
The configuration files are located in /usr/local/etc/openldap
/usr/local/etc/openldap/slapd.conf ---- main configuration file for schema and all.
/usr/local/etc/openldap/schema/ ------ all schema files are located in this directory.
/usr/local/BerkeleyDB.4.5 –Berkeley Installation files located ….
slapd.conf file will look like this.....
% vi /usr/local/etc/openldap/slapd.conf
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
include /usr/local/etc/openldap/schema/core.schema
include /usr/local/etc/openldap/schema/cosine.schema
include /usr/local/etc/openldap/schema/nis.schema
include /usr/local/etc/openldap/schema/inetorgperson.schema
include /usr/local/etc/openldap/schema/java.schema
# BDB database definitions
database bdb
suffix "dc=adminmart,dc=com"
rootdn "cn=Manager,dc=adminmart,dc=com"
rootpw {SSHA}5xkIfOGiLNYkh4PbwTp1XFigY/pRjxwy
directory /usr/local/var/openldap-data
Starting and Stopping LDAP Server
% /usr/local/libexec/slapd –d 256 –f /usr/local/etc/openldap/slapd.conf --(will start with console)
Or
% /usr/local/libexec/slapd
Stopping slapd
To kill off slapd(8) safely, you should give a command like this
% Kill –INT `cat /usr/local/var/run/slapd.pid`
CREATING A DATABASE (Getting Start to add users, group, etc)
Creating LDIF file for importing objects like users and groups.
Sample LDIF
# root
dn: dc=example,dc=com
objectClass: organization
objectClass: dcObject
o: Example, Inc.
dc: example
# people
dn: ou=People,dc=example,dc=com
objectClass: organizationalUnit
ou: People
# company-wide address book
dn: ou=Address Book,dc=example,dc=com
objectClass: organizationalUnit
ou: Address Book
http://www.sys-net.it/~ando/Download/abook.ldif
LDAP Add a user.
$ldapadd -x -D "cn=Manager,dc=adminmart,dc=com" -W -f rttest.ldif
where rttest.ldif
dn: uid=charihar,ou=users,dc=adminmart,dc=com
objectclass: top
objectclass: person
objectclass: uidObject
uid: charihar
cn: Full Name
sn: Name
userPassword: your passwordhere.
LDAP Search quires.
$ ldapsearch -x -b "dc=adminmart,dc=com" '(objectclass=*)'
$ ldapsearch -x -b "dc=adminmart,dc=com" '(uid=sajan)'
$ldapsearch -LLL -H ldap:/// -xWD 'cn=Manager,dc=adminmart,dc=com' -b "ou=users,dc=adminmart,dc=com" "(uid=charihar)"
LDAP delete a user
ldapdelete -xWD "cn=Manager,dc=adminmart,dc=com" "uid=charihar,ou=users,dc=adminmart,dc=com"
Note : - Document not completed.