xref: /netbsd-src/external/bsd/openldap/dist/doc/guide/admin/quickstart.sdf (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1# $OpenLDAP$
2# Copyright 1999-2021 The OpenLDAP Foundation, All Rights Reserved.
3# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5H1: A Quick-Start Guide
6
7The following is a quick start guide to [[DOC_NAME]],
8including the Standalone {{TERM:LDAP}} Daemon, {{slapd}}(8).
9
10It is meant to walk you through the basic steps needed to install
11and configure {{PRD:OpenLDAP Software}}.  It should be used in
12conjunction with the other chapters of this document, manual pages,
13and other materials provided with the distribution (e.g. the
14{{F:INSTALL}} document) or on the {{PRD:OpenLDAP}} web site
15({{URL: http://www.OpenLDAP.org}}), in particular the OpenLDAP
16Software {{TERM:FAQ}} ({{URL: http://www.OpenLDAP.org/faq/?file=2}}).
17
18If you intend to run OpenLDAP Software seriously, you should review
19all of this document before attempting to install the software.
20
21Note: This quick start guide does not use strong authentication
22nor any integrity or confidential protection services.  These
23services are described in other chapters of the
24OpenLDAP Administrator's Guide.
25
26
27.{{S: }}
28^{{B: Get the software}}
29
30. You can obtain a copy of the software by following the
31instructions on the OpenLDAP Software download page
32({{URL: http://www.openldap.org/software/download/}}).  It is
33recommended that new users start with the latest {{release}}.
34
35
36.{{S: }}
37+{{B: Unpack the distribution}}
38
39.Pick a directory for the source to live under, change
40directory to there, and unpack the distribution using the
41following commands:
42
43..{{EX:gunzip -c openldap-VERSION.tgz | tar xvfB -}}
44
45. then relocate yourself into the distribution directory:
46
47..{{EX:cd openldap-VERSION}}
48
49. You'll have to replace {{F:VERSION}} with the version
50name of the release.
51
52
53.{{S: }}
54+{{B: Review documentation}}
55
56. You should now review the {{F:COPYRIGHT}}, {{F:LICENSE}},
57{{F:README}} and {{F:INSTALL}} documents provided with the distribution.
58The {{F:COPYRIGHT}} and {{F:LICENSE}} provide information on
59acceptable use, copying, and limitation of warranty of OpenLDAP
60Software.
61
62.{{S: }}
63. You should also review other chapters of this document.
64In particular, the {{SECT:Building and Installing OpenLDAP Software}}
65chapter of this document provides detailed information on prerequisite
66software and installation procedures.
67
68
69.{{S: }}
70+{{B: Run {{EX:configure}}}}
71
72. You will need to run the provided {{EX:configure}} script to
73{{configure}} the distribution for building on your system.  The
74{{EX:configure}} script accepts many command line options that enable or
75disable optional software features.  Usually the defaults are okay,
76but you may want to change them.  To get a complete list of options
77that {{EX:configure}} accepts, use the {{EX:--help}} option:
78
79..{{EX:./configure --help}}
80
81. However, given that you are using this guide, we'll assume you
82are brave enough to just let {{EX:configure}} determine
83what's best:
84
85..{{EX:./configure}}
86
87. Assuming {{EX:configure}} doesn't dislike your system, you can
88proceed with building the software.  If {{EX:configure}} did
89complain, well, you'll likely need to go to the Software FAQ
90{{Installation}} section ({{URL:http://www.openldap.org/faq/?file=8}})
91and/or actually read the {{SECT:Building and Installing OpenLDAP Software}}
92chapter of this document.
93
94
95.{{S: }}
96+{{B:Build the software}}.
97
98. The next step is to build the software.  This step has two
99parts, first we construct dependencies and then we compile the
100software:
101
102..{{EX:make depend}}
103..{{EX:make}}
104
105
106. Both makes should complete without error.
107
108
109.{{S: }}
110+{{B:Test the build}}.
111
112. To ensure a correct build, you should run the test suite
113(it only takes a few minutes):
114
115..{{EX:make test}}
116
117. Tests which apply to your configuration will run and they
118should pass.  Some tests, such as the replication test, may
119be skipped.
120
121
122.{{S: }}
123+{{B:Install the software}}.
124
125. You are now ready to install the software; this usually requires
126{{super-user}} privileges:
127
128..{{EX:su root -c 'make install'}}
129
130. Everything should now be installed under {{F:/usr/local}} (or
131whatever installation prefix was used by {{EX:configure}}).
132
133.{{S: }}
134+{{B:Edit the configuration file}}.
135
136. Use your favorite editor to edit the provided {{slapd.ldif}}
137example (usually installed as {{F:/usr/local/etc/openldap/slapd.ldif}})
138to contain a MDB database definition of the form:
139
140..{{EX:dn: olcDatabase=mdb,cn=config}}
141..{{EX:objectClass: olcDatabaseConfig}}
142..{{EX:objectClass: olcMdbConfig}}
143..{{EX:olcDatabase: mdb}}
144..{{EX:OlcDbMaxSize: 1073741824}}
145..{{EX:olcSuffix: dc=<MY-DOMAIN>,dc=<COM>}}
146..{{EX:olcRootDN: cn=Manager,dc=<MY-DOMAIN>,dc=<COM>}}
147..{{EX:olcRootPW: secret}}
148..{{EX:olcDbDirectory: /usr/local/var/openldap-data}}
149..{{EX:olcDbIndex: objectClass eq}}
150
151. Be sure to replace {{EX:<MY-DOMAIN>}} and {{EX:<COM>}} with
152the appropriate domain components of your domain name.  For
153example, for {{EX:example.com}}, use:
154
155..{{EX:dn: olcDatabase=mdb,cn=config}}
156..{{EX:objectClass: olcDatabaseConfig}}
157..{{EX:objectClass: olcMdbConfig}}
158..{{EX:olcDatabase: mdb}}
159..{{EX:OlcDbMaxSize: 1073741824}}
160..{{EX:olcSuffix: dc=example,dc=com}}
161..{{EX:olcRootDN: cn=Manager,dc=example,dc=com}}
162..{{EX:olcRootPW: secret}}
163..{{EX:olcDbDirectory: /usr/local/var/openldap-data}}
164..{{EX:olcDbIndex: objectClass eq}}
165
166.If your domain contains additional components, such as
167{{EX:eng.uni.edu.eu}}, use:
168
169..{{EX:dn: olcDatabase=mdb,cn=config}}
170..{{EX:objectClass: olcDatabaseConfig}}
171..{{EX:objectClass: olcMdbConfig}}
172..{{EX:olcDatabase: mdb}}
173..{{EX:OlcDbMaxSize: 1073741824}}
174..{{EX:olcSuffix: dc=eng,dc=uni,dc=edu,dc=eu}}
175..{{EX:olcRootDN: cn=Manager,dc=eng,dc=uni,dc=edu,dc=eu}}
176..{{EX:olcRootPW: secret}}
177..{{EX:olcDbDirectory: /usr/local/var/openldap-data}}
178..{{EX:olcDbIndex: objectClass eq}}
179
180. Details regarding configuring {{slapd}}(8) can be found
181in the {{slapd-config}}(5) manual page and the {{SECT:Configuring
182slapd}} chapter of this document.  Note that the
183specified olcDbDirectory must exist prior to starting {{slapd}}(8).
184
185
186.{{S: }}
187+{{B:Import the configuration database}}
188. You are now ready to import your configuration database for use by
189{{slapd}}(8), by running the command:
190
191..{{EX: su root -c /usr/local/sbin/slapadd -n 0 -F /usr/local/etc/slapd.d -l /usr/local/etc/openldap/slapd.ldif}}
192
193.{{S: }}
194+{{B:Start SLAPD}}.
195
196. You are now ready to start the Standalone LDAP Daemon, {{slapd}}(8),
197by running the command:
198
199..{{EX:su root -c /usr/local/libexec/slapd -F /usr/local/etc/slapd.d}}
200
201
202. To check to see if the server is running and configured correctly,
203you can run a search against it with {{ldapsearch}}(1).  By default,
204{{ldapsearch}} is installed as {{F:/usr/local/bin/ldapsearch}}:
205
206..{{EX:ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts}}
207
208. Note the use of single quotes around command parameters to prevent
209special characters from being interpreted by the shell.  This should return:
210
211..{{EX:dn:}}
212..{{EX:namingContexts: dc=example,dc=com}}
213
214. Details regarding running {{slapd}}(8) can be found
215in the {{slapd}}(8) manual page and the
216{{SECT:Running slapd}} chapter of this document.
217
218
219.{{S: }}
220+{{B:Add initial entries to your directory}}.
221
222. You can use {{ldapadd}}(1) to add entries to your LDAP directory.
223{{ldapadd}} expects input in {{TERM:LDIF}} form.  We'll do it in two
224steps:
225
226^^ create an LDIF file
227++ run ldapadd
228
229. Use your favorite editor and create an LDIF file that contains:
230
231..{{EX:dn: dc=<MY-DOMAIN>,dc=<COM>}}
232..{{EX:objectclass: dcObject}}
233..{{EX:objectclass: organization}}
234..{{EX:o: <MY ORGANIZATION>}}
235..{{EX:dc: <MY-DOMAIN>}}
236..{{EX:}}
237..{{EX:dn: cn=Manager,dc=<MY-DOMAIN>,dc=<COM>}}
238..{{EX:objectclass: organizationalRole}}
239..{{EX:cn: Manager}}
240
241. Be sure to replace {{EX:<MY-DOMAIN>}} and {{EX:<COM>}} with the
242appropriate domain components of your domain name.  {{EX:<MY
243ORGANIZATION>}} should be replaced with the name of your organization.
244When you cut and paste, be sure to trim any leading and trailing
245whitespace from the example.
246
247..{{EX:dn: dc=example,dc=com}}
248..{{EX:objectclass: dcObject}}
249..{{EX:objectclass: organization}}
250..{{EX:o: Example Company}}
251..{{EX:dc: example}}
252..{{EX:}}
253..{{EX:dn: cn=Manager,dc=example,dc=com}}
254..{{EX:objectclass: organizationalRole}}
255..{{EX:cn: Manager}}
256
257. Now, you may run {{ldapadd}}(1) to insert these entries into
258your directory.
259
260..{{EX:ldapadd -x -D "cn=Manager,dc=<MY-DOMAIN>,dc=<COM>" -W -f example.ldif}}
261
262. Be sure to replace {{EX:<MY-DOMAIN>}} and {{EX:<COM>}} with the
263appropriate domain components of your domain name.  You will be
264prompted for the "{{EX:secret}}" specified in {{F:slapd.conf}}.
265For example, for {{EX:example.com}}, use:
266
267..{{EX:ldapadd -x -D "cn=Manager,dc=example,dc=com" -W -f example.ldif}}
268
269. where {{F:example.ldif}} is the file you created above.
270..{{EX: }}
271. Additional information regarding directory creation can be found
272in the {{SECT:Database Creation and Maintenance Tools}} chapter of
273this document.
274
275.{{S: }}
276+{{B:See if it works}}.
277
278. Now we're ready to verify the added entries are in your directory.
279You can use any LDAP client to do this, but our example uses the
280{{ldapsearch}}(1) tool.  Remember to replace {{EX:dc=example,dc=com}}
281with the correct values for your site:
282
283..{{EX:ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'}}
284
285. This command will search for and retrieve every entry in the database.
286
287You are now ready to add more entries using {{ldapadd}}(1) or
288another LDAP client, experiment with various configuration options,
289backend arrangements, etc..
290
291Note that by default, the {{slapd}}(8) database grants {{read access
292to everybody}} excepting the {{super-user}} (as specified by the
293{{EX:rootdn}} configuration directive).  It is highly recommended
294that you establish controls to restrict access to authorized users.
295Access controls are discussed in the {{SECT:Access Control}} chapter.
296You are also encouraged to read the {{SECT:Security Considerations}},
297{{SECT:Using SASL}} and {{SECT:Using TLS}} sections.
298
299The following chapters provide more detailed information on making,
300installing, and running {{slapd}}(8).
301