]> git.sur5r.net Git - openldap/blob - doc/guide/admin/quickstart.sdf
98d6fc42779db97989f87adb41c54f9153b5736d
[openldap] / doc / guide / admin / quickstart.sdf
1 # $OpenLDAP$
2 # Copyright 1999-2000, The OpenLDAP Foundation, All Rights Reserved.
3 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5 H1: A Quick-Start Guide to Running slapd
6
7 This chapter provides a quick step-by-step guide to building,
8 installing and running {{slapd}}(8). It is intended to provide
9 users with a simple and quick way to get started only.
10 If you intend to run slapd seriously, you should read the rest
11 of this guide.
12
13
14 Note: This guide does not use strong authentication nor any
15 privacy and integrity protection services.  These services are
16 described in detail in later chapters.  This guide should
17 only be used in isolated environments (such as on a single
18 host protected by a firewall).
19
20
21 ^{{B:Get the software}}.
22
23 .{{slapd}} is part of the {{PRD:OpenLDAP}} distribution, which
24 you can retrieve from {{URL: http://www.openldap.org/software/download/}}
25 or {{URL: ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release.tgz}}.
26 If you are reading this guide, you have probably already done this.
27
28 .{{S: }}
29 +{{B:Unpack the distribution}}.
30
31 .Pick a directory for the LDAP source to live under and change
32 directory there, and untar it. For example:
33
34 ..{{EX:cd /usr/local/src}}
35 ..{{EX:gunzip -c openldap-release.tgz | tar xvfB -}}
36 ..{{EX:cd openldap-release}}
37
38 . You'll have to replace {{F:openldap-release}} with the full
39 name of the release.
40
41
42 .{{S: }}
43 +{{B: Configure the software}}.
44
45 .You will need to run the {{EX:configure}} script to configure slapd.
46
47 ..{{EX:./configure}}
48
49 . The {{EX:configure}} accepts many command line options that enable
50 or disable optional software features.  Usually the defaults are okay,
51 but you may want to change them.  To get a complete list of options
52 that {{EX:configure}} accepts, use the {{EX:--help}} option.
53
54 ..{{EX:./configure --help}}
55
56 . Once OpenLDAP has been configured, it needs to be compiled.  
57 You'll need to construct dependencies and then compile the software
58 using {{make}}(1) utility.
59 For example:
60
61 ..{{EX:make depend}}
62 ..{{EX:make}}
63
64 . Once OpenLDAP is compiled you need to install it.  By default OpenLDAP 
65 is installed into {{F:/usr/local}}.  This is typically done as root.
66
67 ..{{EX:su root -c 'make install'}}
68
69
70 .{{S: }}
71 +{{B:Edit the configuration file}}.
72
73 .Use this chapter as a brief tutorial.  For more details on the
74 configuration file, see slapd.conf(5) and chapter 5.
75
76 .Now we need to edit the default configuration file that was
77 installed earlier.  The {{slapd}} configuration file {{slapd.conf}}(5)
78 for is normally located at {{F:/usr/local/etc/openldap/slapd.conf}}.
79 If you specified the {{EX:--prefix}} option when you ran {{EX:configure}},
80 then replace {{F:/usr/local}} with the value you gave as the
81 prefix.  For example, if you ran {{EX:configure}} as
82
83 ..{{EX:./configure --prefix=/opt/ldap}}
84
85 .You would find your configuration file in
86 {{F:/opt/ldap/etc/openldap/slapd.conf}}. 
87 Now look in the configuration file for a line that begins with 
88
89 ..{{EX:database          ldbm}}
90
91 .This marks the begining of the database configuration for {{slapd}}.
92 Everything you will need to change for this example is located
93 after this line.
94
95 .Listed below are the default settings for the database in
96 {{F:slapd.conf}}(5).  Lines that begin with a sharp sign ('{{EX:#}}')
97 are considered to be comments by slapd, they have been removed
98 from the listing below to save space.  If a line starts with
99 white space it is considered a continuation of the preceeding
100 line.
101
102 ..{{EX:suffix          "dc=my-domain, dc=com"}}
103 ..{{EX:rootdn          "cn=Manager, dc=my-domain, dc=com"}}
104 ..{{EX:rootpw          secret}}
105 ..{{EX:directory       /usr/local/var/openldap-ldbm}}
106
107 . Now we need to replace all of the references to {{EX:my-domain}}
108 and {{EX:com}} with the correct value.  For example, if your domain
109 is {{EX:example.net}} we might use the following.
110
111 ..{{EX:suffix          "dc=example, dc=net"}}
112 ..{{EX:rootdn          "cn=Manager, dc=example, dc=net"}}
113 ..{{EX:rootpw          secret}}
114 ..{{EX:directory       /usr/local/var/openldap-ldbm}}
115
116 . By default, the database files will be created in
117 {{F:/usr/local/var/openldap-ldbm}}.
118 You may specify an alternate directory via the directory option
119 in the {{F:slapd.conf}} file.  The directory must exist before
120 you start the server.
121
122 Note: Use of rootpw is deprecated in favor of strong authentication
123 mechanisms.  These are described in later chapters.
124
125 .{{S: }}
126 +{{B:Starting the server}}.
127
128 .You are now ready to start the server by running the command
129 {{slapd}}(8):
130
131 ..{{EX:/usr/local/libexec/slapd}}
132
133 . At this point the LDAP server is up and running, but there isn't
134 any data in the directory.  You can check to see if the server is
135 running and your naming context (the {{EX:suffix}} you specified above)
136 by searching it with {{ldapsearch}}(1).  By default ldapsearch is
137 installed as {{F:/usr/local/bin/ldapsearch}}.
138
139 ..{{EX:ldapsearch -x -b '' -s base '(objectclass=*)' namingContexts}}
140
141 . Note the use of single quotes around command parameters to prevent
142 special characters from interpreted by the shell.  This should return:
143
144 ..{{EX:dn:}}
145 ..{{EX:namingContexts: dc=example, dc=net}}
146
147
148 .{{S: }}
149 +{{B:Create a database}}.
150
151 . This is a two-step process. The first step is to create a file
152 (we'll call it {{F:example.ldif}}) containing the entries you
153 want your database to contain. Use the following example as a
154 guide, or see Section 7.3 for more details.
155
156 ..{{EX:dn: dc=example, dc=net}}
157 ..{{EX:objectclass: dcObject}}
158 ..{{EX:objectclass: organization}}
159 ..{{EX:o: Example Network}}
160 ..{{EX:dc: example}}
161 ..{{EX: }}
162 ..{{EX:dn: cn=Bob Smith, dc=example, dc=net}}
163 ..{{EX:objectclass: person}}
164 ..{{EX:cn: Bob Smith}}
165 ..{{EX:sn: Smith}}
166
167 .Remember to replace {{EX:dc=example, dc=net}} with the correct
168 values for your site, and to put your name instead of Bob's.  You can
169 include additional entries and attributes in this file if you want,
170 or add them later via LDAP.
171
172 .The second step is to run a tool to add the contents of this file to the
173 your directory.  We use the tool {{ldapadd}}(1) to populate the directory.
174 Again remember to replace {{EX:dc=example, dc=net}} with the correct values
175 for your site.  By default ldapadd is installed as
176 {{F:/usr/local/bin/ldapadd}}.
177
178 ..{{EX:ldapadd -x -D 'cn=Manager,dc=example,dc=net' -w secret -f example.ldif}}
179
180 .Where {{F:example.ldif}} is the file you created above.
181
182 Note: Use of transport security services is recommended when updating
183 the directory.  These services are described in later chapters.
184
185
186 .{{S: }}
187 +{{B:See if it works}}.
188
189 .Now we're ready to verify the added entries are in your directory.  
190 You can use any LDAP client to do this, but our example uses the
191 {{ldapsearch}}(1) tool.  Remember to replace {{EX:dc=example,dc=net}}
192 with the correct values for your site.
193
194 ..{{EX:ldapsearch -x -b 'dc=example,dc=net' '(objectclass=*)'}}
195
196 .This command will search for and retrieve every entry in the database.
197
198 You are now ready to add more entries using {{ldapadd}}(1) or
199 another LDAP client, experiment with various configuration options,
200 backend arrangements, etc. Note that by default, the {{slapd}}(8)
201 database grants {{read access to everybody}} excepting the
202 {{super-user}} (as specified by the {{EX:rootdn}} configuration
203 directive).  It is highly recommended that you establish controls
204 to restrict access to authorized users.  Access controls are discussed
205 in a later chapter.
206
207 The following chapters provide more detailed information on making,
208 installing, and running {{slapd}}(8).
209