LDAP address book in Debian

#apt-get install slapd ldap-utils ldapscripts

edit /etc/ldap/slapd.conf
—————————-
//change the suffix accodring to your domain. here “example.com.bd”
suffix “dc=example,dc=com,dc=bd”

//uncomment this line
rootdn “cn=admin,dc=example,dc=com,dc=bd”

//add after rootdn line (it is plain text password)
rootpw secret

//change the dc=example,dc=com,dc=bd everywhere in slapd.conf
//keep other config as it is.

restart ldap
#/etc/init.d/slapd restart

edit /etc/ldap/ldap.conf

create a file name directory.ldif in /etc/ldap/schema/

directory.ldif
—————-
dn: dc=example,dc=com,dc=bd
objectClass: top
objectClass: dcObject
objectClass: organization
dc: example
o: Example Inc.

dn: ou=addressbook, dc=example,dc=com,dc=bd
objectClass: top
objectClass: organizationalUnit
ou: addressbook

from shell cd to /etc/ldap/schema/
$ldapadd -x -D ‘cn=admin,dc=example,dc=com,dc=bd’ -f directory.ldif -W
(give pass secret here)

To check
$ldapsearch -b ‘dc=example,dc=com,dc=bd’ ‘objectclass=*’ -x

Input data using phpldapadmin

#apt-get install phpldapadmin

http://localhost/phpldapadmin/

login: cn=admin,dc=example,dc=com,dc=bd
pass: secret

or you can add data manually

create a file contact.ldif in /etc/ldap/schema/

contact.ldif
————–
dn: cn=Blogger OS, ou=addressbook,dc=example,dc=com,dc=bd
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
cn: Blogger
gn: Ldap
sn: OS
mail: blogger@example.com.bd
physicalDeliveryOfficeName: Dhaka, Bangladesh.
postalAddress: PO BOX 909
ou: addressbook
st: LA
postalCode: 1215
telephoneNumber: 111-111-1111
facsimileTelephoneNumber: 111-111-1111
pager: 111-111-1111
mobile: 111-111-1111
homePhone: 111-111-1111

from shell cd to /etc/ldap/schema/
$ldapadd -x -D ‘cn=admin,dc=example,dc=com,dc=bd’ -f contact.ldif -W
(give pass secret here)

To check
$ldapsearch -b ‘dc=example,dc=com,dc=bd’ ‘objectclass=*’ -x

Reference:
ONLamp.com Link

OpenLDAP Link