Friday, July 05, 2013

OPEN LDAP STEP BY STEP INSTALLATION ON LINUX

PREREQUISITES:
Download Berkeley DB (db-4.8.30.NC.tar.gz) from Following Link
Sudo su
root$ mkdir /usr/local/BerkelyDB4.8
cd /usr/local/BerkelyDB4.8/
chown -R rjuluri:dba  /usr/local/BerkelyDB4.8/
tar xvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC

cd build_unix

INSTALL BERKELY DB: LINK FOR INSTALLATION


$ ../dist/configure
$make
$ make install

Exit the root

INSTALLATION OF BERKELY DB IS COMPLETED, NOW INSTALL OPENLDAP

Get the software
You can obtain a copy of the software by following the instructions on the OpenLDAP download page (http://www.openldap.org/software/download/). It is recommended that new users start with the latest release.

tar xvf openldap*.gz

cd /scratch/rjuluri/openldap-2.4.35/

CPPFLAGS="-I/usr/local/include -I/usr/local/BerkeleyDB.4.8/include" LDFLAGS="-L/usr/local/lib -L/usr/local/BerkeleyDB.4.8/lib -R/usr/local/lib -R/usr/local/BerkeleyDB.4.8/lib -R/usr/local/ssl/lib" LD_LIBRARY_PATH="/usr/local/BerkeleyDB.4.8/lib" ./configure --prefix=/scratch/rjuluri/openldap-2.4.35
make depend
                   make
                   make test
                   sudo su (root)
                   make install
Added these lines to /scratch/rjuluri/openldap-2.4.35/etc/openldap/slapd.conf
include         /scratch/rjuluri/openldap-2.4.35/etc/openldap/schema/cosine.schema
include         /scratch/rjuluri/openldap-2.4.35/etc/openldap/schema/inetorgperson.schema
include         /scratch/rjuluri/openldap-2.4.35/etc/openldap/schema/nis.schema

Edit the configuration file.
Use your favorite editor to edit the provided slapd.conf(5) example (usually installed as /usr/local/etc/openldap/slapd.conf) to contain a BDB database definition of the form:
database bdb
suffix "dc=,dc="
rootdn "cn=Manager,dc=,dc="
rootpw secret
directory /usr/local/var/openldap-data

Be sure to replace  and  with the appropriate domain components of your domain name. For example, for example.com, use:
database bdb
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
rootpw secret
directory /usr/local/var/openldap-data


START OPENLDAP:
You are now ready to start the stand-alone LDAP server, slapd(8), by running the command:
su root -c /scratch/rjuluri/openldap-2.4.35/libexec/slapd

To check to see if the server is running and configured correctly, you can run a search against it with ldapsearch(1). By default, ldapsearch is installed as /scratch/rjuluri/openldap-2.4.35/ bin/ldapsearch:
ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts

Note the use of single quotes around command parameters to prevent special characters from being interpreted by the shell. This should return:
dn:
namingContexts: dc=example,dc=com

vi example.ldif

## DEFINE DIT ROOT/BASE/SUFFIX ####
## uses RFC 2377 format
## replace example and com as necessary below
## or for experimentation leave as is

## dcObject is an AUXILLIARY objectclass and MUST
## have a STRUCTURAL objectclass (organization in this case)
# this is an ENTRY sequence and is preceded by a BLANK line

dn: dc=example,dc=com
dc: example
description: My wonderful company as much text as you want to place
in this line up to 32K continuation data for the line above must
have <CR> or <CR><LF> i.e. ENTER works
on both Windows and *nix system - new line MUST begin with ONE SPACE
objectClass: dcObject
objectClass: organization
o: Example, Inc.

## FIRST Level hierarchy - people
## uses mixed upper and lower case for objectclass
# this is an ENTRY sequence and is preceded by a BLANK line

dn: ou=people, dc=example,dc=com
ou: people
description: All people in organisation
objectclass: organizationalunit

## SECOND Level hierarchy
## ADD a single entry under FIRST (people) level
# this is an ENTRY sequence and is preceded by a BLANK line
# the ou: Human Resources is the department name

dn: cn=Robert Smith,ou=people,dc=example,dc=com
objectclass: inetOrgPerson
cn: Robert Smith
cn: Robert J Smith
cn: bob  smith
sn: smith
uid: rjsmith
userpassword: rJsmitH
carlicense: HISCAR 123
homephone: 555-111-2222
mail: r.smith@example.com
mail: rsmith@example.com
mail: bob.smith@example.com
description: swell guy
ou: Human Resources

#######################################################################

./ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f example.ldif
./ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts

No comments:

Popular Posts