|Securing and Optimizing Linux: RedHat Edition -A Hands on Guide|
|Prev||Chapter 26. Linux OpenLDAP Server||Next|
To Create of the LDMB backend database, there are two methods to create a database for LDAP,
The first is off-line with the ldif2ldbm command utility
The other is on-line with the ldapadd command utility.
The off-line method requires that your slapd daemon is not running
The on-line method requires that your slapd daemon of LDAP is running.
The first thing to do is to create an LDIF input file containing a text representation of your entries. The text file named my-data-file below can be used as an example file. Of course, your real LDIF input file will handle much more information than this example. When you install OpenLDAP for the first time and have big entries to put in your backend database, it's always a good idea to put all this information into a text file and add them into your backend database with the ldif2ldbm command utility.
Example 26-1. my-data-file
Create the file, touch /tmp/my-data-file and add as an example in this file the following lines:
dn: o=openna, c=com o: openna objectclass: organization dn: cn=Gerhard Mourani, o=openna, c=com cn: Gerhard Mourani sn: Mourani mail: email@example.com title: Author objectclass: person dn: cn=Anthony Bay, o=openna, c=com cn: Anthony Bay sn: Bay homephone: (444) 111-2233 mobile: (444) 555-6677 mail: firstname.lastname@example.org objectclass: person dn: cn=George Parker, o=openna, c=com cn: George Parker sn: Parker telephonenumber: (555) 234-5678 fax: (543) 987-6543 mobile: (543) 321-4354 description: E-Commerce objectclass: person
Once the LDIF input file containing our entries has been created, we must insert it in the LDAP directory server. To insert the LDIF input file and create the database off-line, use the following command:
[root@deep ]/tmp# ldif2ldbm -i <inputfile> -f <slapdconfigfile> [root@deep ]/tmp# ldif2ldbm -i my-data-file -f /etc/openldap/slapd.conf
: It is important to note that the slapd daemon of LDAP is not started in this mode of creation.