1 | <?xml version="1.0" encoding="iso-8859-1"?>
|
---|
2 | <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
|
---|
3 | <chapter id="compiling">
|
---|
4 | <chapterinfo>
|
---|
5 | &author.jelmer;
|
---|
6 | &author.jht;
|
---|
7 | &author.tridge;
|
---|
8 |
|
---|
9 | <pubdate> 22 May 2001 </pubdate>
|
---|
10 | <pubdate> 18 March 2003 </pubdate>
|
---|
11 | <pubdate> June 2005 </pubdate>
|
---|
12 | </chapterinfo>
|
---|
13 |
|
---|
14 | <title>How to Compile Samba</title>
|
---|
15 |
|
---|
16 | <para>
|
---|
17 | You can obtain the Samba source file from the
|
---|
18 | <ulink url="http://samba.org/">Samba Web site</ulink>. To obtain a development version,
|
---|
19 | you can download Samba from Subversion or using <command>rsync</command>.
|
---|
20 | </para>
|
---|
21 |
|
---|
22 | <sect1>
|
---|
23 | <title>Access Samba Source Code via GIT</title>
|
---|
24 |
|
---|
25 |
|
---|
26 | <sect2>
|
---|
27 | <title>Introduction</title>
|
---|
28 |
|
---|
29 | <para>
|
---|
30 | <indexterm><primary>Subversion</primary></indexterm>
|
---|
31 | Samba is developed in an open environment. Developers use
|
---|
32 | GIT to <quote>checkin</quote> (also known as
|
---|
33 | <quote>commit</quote>) new source code. See the
|
---|
34 | <ulink noescape="1"
|
---|
35 | url="https://wiki.samba.org/index.php/Using_Git_for_Samba_Development">Using
|
---|
36 | Git for Samba Development page</ulink> in the Samba wiki.
|
---|
37 | </para>
|
---|
38 |
|
---|
39 | </sect2>
|
---|
40 |
|
---|
41 |
|
---|
42 | </sect1>
|
---|
43 |
|
---|
44 | <sect1>
|
---|
45 | <title>Accessing the Samba Sources via rsync and ftp</title>
|
---|
46 |
|
---|
47 |
|
---|
48 | <para>
|
---|
49 | <indexterm><primary>rsync</primary></indexterm>
|
---|
50 | <indexterm><primary>ftp</primary></indexterm>
|
---|
51 | <parameter>pserver.samba.org</parameter> also exports unpacked copies of most parts of the Subversion tree
|
---|
52 | at the Samba <ulink noescape="1" url="ftp://samba.org/pub/unpacked">unpacked</ulink> location and also
|
---|
53 | via anonymous rsync at the Samba <ulink noescape="1"
|
---|
54 | url="rsync://samba.org/ftp/unpacked/">rsync</ulink> server location. I recommend using rsync rather
|
---|
55 | than ftp, because rsync is capable of compressing data streams, but it is also more useful than FTP because
|
---|
56 | during a partial update it will transfer only the data that is missing plus a small overhead. See <ulink
|
---|
57 | noescape="1" url="http://rsync.samba.org/">the rsync home page</ulink> for more info on rsync.
|
---|
58 | </para>
|
---|
59 |
|
---|
60 | <para>
|
---|
61 | The disadvantage of the unpacked trees is that they do not support automatic
|
---|
62 | merging of local changes as GIT does. <command>rsync</command> access is most convenient
|
---|
63 | for an initial install.
|
---|
64 | </para>
|
---|
65 | </sect1>
|
---|
66 |
|
---|
67 | <sect1>
|
---|
68 | <title>Verifying Samba's PGP Signature</title>
|
---|
69 |
|
---|
70 | <para>
|
---|
71 | <indexterm><primary>GPG</primary></indexterm>
|
---|
72 | <indexterm><primary>PGP</primary></indexterm>
|
---|
73 | It is strongly recommended that you verify the PGP signature for any source file before
|
---|
74 | installing it. Even if you're not downloading from a mirror site, verifying PGP signatures
|
---|
75 | should be a standard reflex. Many people today use the GNU GPG tool set in place of PGP.
|
---|
76 | GPG can substitute for PGP.
|
---|
77 | </para>
|
---|
78 |
|
---|
79 |
|
---|
80 | <para>
|
---|
81 | With that said, go ahead and download the following files:
|
---|
82 | </para>
|
---|
83 |
|
---|
84 | <para><screen>
|
---|
85 | &prompt;<userinput>wget http://samba.org/samba/ftp/samba-latest.tar.asc</userinput>
|
---|
86 | &prompt;<userinput>wget http://samba.org/samba/ftp/samba-latest.tar.gz</userinput>
|
---|
87 | &prompt;<userinput>wget http://samba.org/samba/ftp/samba-pubkey.asc</userinput>
|
---|
88 | </screen></para>
|
---|
89 |
|
---|
90 |
|
---|
91 | <para>
|
---|
92 | <indexterm><primary>PGP</primary></indexterm>
|
---|
93 | The first file is the PGP signature for the Samba source file; the other is the Samba public
|
---|
94 | PGP key itself. Import the public PGP key with:
|
---|
95 | <screen>
|
---|
96 | &prompt;<userinput>gpg --import samba-pubkey.asc</userinput>
|
---|
97 | </screen>
|
---|
98 | and verify the Samba source code integrity with:
|
---|
99 | <screen>
|
---|
100 | &prompt;<userinput>gzip -d samba-latest.tar.gz</userinput>
|
---|
101 | &prompt;<userinput>gpg --verify samba-latest.tar.asc</userinput>
|
---|
102 | </screen>
|
---|
103 | </para>
|
---|
104 |
|
---|
105 | <para>
|
---|
106 | If you receive a message like, <quote>Good signature from Samba Distribution Verification Key...,</quote>
|
---|
107 | then all is well. The warnings about trust relationships can be ignored. An
|
---|
108 | example of what you would not want to see would be:
|
---|
109 | <screen>
|
---|
110 | gpg: BAD signature from <quote>Samba Distribution Verification Key</quote>
|
---|
111 | </screen>
|
---|
112 | </para>
|
---|
113 |
|
---|
114 | </sect1>
|
---|
115 |
|
---|
116 | <sect1>
|
---|
117 | <title>Building the Binaries</title>
|
---|
118 |
|
---|
119 | <para>
|
---|
120 | <indexterm><primary>configure</primary></indexterm>
|
---|
121 | To build the binaries, run the program <userinput>./configure
|
---|
122 | </userinput> in the top level directory of the source tree. This should automatically
|
---|
123 | configure Samba for your operating system. If you have unusual
|
---|
124 | needs, then you may wish to first run:
|
---|
125 | <screen>
|
---|
126 | &rootprompt;<userinput>./configure --help</userinput>
|
---|
127 | </screen>
|
---|
128 | </para>
|
---|
129 |
|
---|
130 | <para>
|
---|
131 | This will help you to see what special options can be enabled. Now execute
|
---|
132 | <userinput>./configure</userinput> with any arguments it might need:
|
---|
133 | <screen>
|
---|
134 | &rootprompt;<userinput>./configure <replaceable>[... arguments ...]</replaceable></userinput>
|
---|
135 | </screen>
|
---|
136 | </para>
|
---|
137 |
|
---|
138 | <para>
|
---|
139 | <indexterm><primary>make</primary></indexterm>
|
---|
140 | Execute the following create the binaries:
|
---|
141 | <screen>
|
---|
142 | &rootprompt; <userinput>make</userinput>
|
---|
143 | </screen>
|
---|
144 | Once it is successfully compiled, you can execute the command shown here to
|
---|
145 | install the binaries and manual pages:
|
---|
146 | <screen>
|
---|
147 | &rootprompt; <userinput>make install</userinput>
|
---|
148 | </screen>
|
---|
149 | </para>
|
---|
150 |
|
---|
151 | <sect2>
|
---|
152 | <title>Compiling Samba with Active Directory Support</title>
|
---|
153 |
|
---|
154 | <para>
|
---|
155 | In order to compile Samba with ADS support, you need to have installed
|
---|
156 | on your system:
|
---|
157 | </para>
|
---|
158 |
|
---|
159 | <itemizedlist>
|
---|
160 |
|
---|
161 | <listitem><para>
|
---|
162 | The MIT or Heimdal Kerberos development libraries
|
---|
163 | (either install from the sources or use a package).
|
---|
164 | </para></listitem>
|
---|
165 |
|
---|
166 | <listitem><para>
|
---|
167 | The OpenLDAP development libraries.
|
---|
168 | </para></listitem>
|
---|
169 |
|
---|
170 | </itemizedlist>
|
---|
171 |
|
---|
172 | <para>
|
---|
173 | If your Kerberos libraries are in a nonstandard location, then
|
---|
174 | remember to add the configure option
|
---|
175 | <option>--with-krb5=<replaceable>DIR</replaceable></option>.
|
---|
176 | </para>
|
---|
177 |
|
---|
178 | <para>
|
---|
179 | After you run configure, make sure that the
|
---|
180 | <filename>bin/default/include/config.h</filename> it generates contain lines like this:
|
---|
181 | <programlisting>
|
---|
182 | #define HAVE_KRB5 1
|
---|
183 | #define HAVE_LDAP 1
|
---|
184 | </programlisting>
|
---|
185 | </para>
|
---|
186 |
|
---|
187 | <para>
|
---|
188 | If it does not, configure did not find your KRB5 libraries or
|
---|
189 | your LDAP libraries. Look in <filename>bin/config.log</filename> to figure
|
---|
190 | out why and fix it.
|
---|
191 | </para>
|
---|
192 |
|
---|
193 | <sect3>
|
---|
194 | <title>Installing the Required Packages for Debian</title>
|
---|
195 |
|
---|
196 | <para>On Debian, you need to install the following packages:</para>
|
---|
197 | <para>
|
---|
198 | <itemizedlist>
|
---|
199 | <listitem><para>libkrb5-dev</para></listitem>
|
---|
200 | <listitem><para>krb5-user</para></listitem>
|
---|
201 | </itemizedlist>
|
---|
202 | </para>
|
---|
203 | </sect3>
|
---|
204 |
|
---|
205 | <sect3>
|
---|
206 | <title>Installing the Required Packages for Red Hat Linux</title>
|
---|
207 |
|
---|
208 | <para>On Red Hat Linux, this means you should have at least: </para>
|
---|
209 | <para>
|
---|
210 | <itemizedlist>
|
---|
211 | <listitem><para>krb5-workstation (for kinit)</para></listitem>
|
---|
212 | <listitem><para>krb5-libs (for linking with)</para></listitem>
|
---|
213 | <listitem><para>krb5-devel (because you are compiling from source)</para></listitem>
|
---|
214 | </itemizedlist>
|
---|
215 | </para>
|
---|
216 |
|
---|
217 | <para>in addition to the standard development environment.</para>
|
---|
218 |
|
---|
219 | <para>If these files are not installed on your system, you should check the installation
|
---|
220 | CDs to find which has them and install the files using your tool of choice. If in doubt
|
---|
221 | about what tool to use, refer to the Red Hat Linux documentation.</para>
|
---|
222 |
|
---|
223 | </sect3>
|
---|
224 |
|
---|
225 | <sect3>
|
---|
226 | <title>SuSE Linux Package Requirements</title>
|
---|
227 |
|
---|
228 | <para>
|
---|
229 | SuSE Linux installs Heimdal packages that may be required to allow you to build
|
---|
230 | binary packages. You should verify that the development libraries have been installed on
|
---|
231 | your system.
|
---|
232 | </para>
|
---|
233 |
|
---|
234 | <para>
|
---|
235 | SuSE Linux Samba RPMs support Kerberos. Please refer to the documentation for
|
---|
236 | your SuSE Linux system for information regarding SuSE Linux specific configuration.
|
---|
237 | Additionally, SuSE is very active in the maintenance of Samba packages that provide
|
---|
238 | the maximum capabilities that are available. You should consider using SuSE-provided
|
---|
239 | packages where they are available.
|
---|
240 | </para>
|
---|
241 |
|
---|
242 | </sect3>
|
---|
243 |
|
---|
244 | </sect2>
|
---|
245 |
|
---|
246 | </sect1>
|
---|
247 |
|
---|
248 | <sect1 id="startingSamba">
|
---|
249 | <title>Starting the &smbd; &nmbd; and &winbindd;</title>
|
---|
250 |
|
---|
251 |
|
---|
252 | <para>
|
---|
253 | <indexterm><primary>inetd</primary></indexterm>
|
---|
254 | You must choose to start &smbd;, &winbindd; and &nmbd; either as daemons or from
|
---|
255 | <application>inetd</application>. Don't try to do both! Either you can put
|
---|
256 | them in <filename> inetd.conf</filename> and have them started on demand by
|
---|
257 | <application>inetd</application> or <application>xinetd</application>, or you
|
---|
258 | can start them as daemons either from the command-line or in
|
---|
259 | <filename>/etc/rc.local</filename>. See the man pages for details on the
|
---|
260 | command line options. Take particular care to read the bit about what user
|
---|
261 | you need to have to start Samba. In many cases, you must be root.
|
---|
262 | </para>
|
---|
263 |
|
---|
264 | <para>
|
---|
265 | The main advantage of starting &smbd; and &nmbd; using the recommended daemon method
|
---|
266 | is that they will respond slightly more quickly to an initial connection request.
|
---|
267 | </para>
|
---|
268 |
|
---|
269 | <sect2>
|
---|
270 | <title>Starting &smbd; as a Daemon</title>
|
---|
271 |
|
---|
272 | <para>
|
---|
273 | <indexterm><primary>daemon</primary></indexterm>
|
---|
274 | <indexterm><primary>startsmb</primary></indexterm>
|
---|
275 | To start the server as a daemon, you should create a script something
|
---|
276 | like this one, perhaps calling it <filename>startsmb</filename>.
|
---|
277 | </para>
|
---|
278 |
|
---|
279 | <para><programlisting>
|
---|
280 | #!/bin/sh
|
---|
281 | /usr/local/samba/sbin/smbd -D
|
---|
282 | /usr/local/samba/sbin/winbindd -D
|
---|
283 | /usr/local/samba/sbin/nmbd -D
|
---|
284 | </programlisting></para>
|
---|
285 |
|
---|
286 | <para>
|
---|
287 | Make it executable with <command>chmod +x startsmb</command>.
|
---|
288 | </para>
|
---|
289 |
|
---|
290 | <para>
|
---|
291 | You can then run <command>startsmb</command> by hand or execute
|
---|
292 | it from <filename>/etc/rc.local</filename>.
|
---|
293 | </para>
|
---|
294 |
|
---|
295 | <para>
|
---|
296 | To kill it, send a kill signal to the processes &nmbd; and &smbd;.
|
---|
297 | </para>
|
---|
298 |
|
---|
299 | <note><para>
|
---|
300 | If you use the SVR4-style init system, you may like to look at the
|
---|
301 | <filename>examples/svr4-startup</filename> script to make Samba fit
|
---|
302 | into that system.
|
---|
303 | </para></note>
|
---|
304 |
|
---|
305 | <sect3>
|
---|
306 | <title>Starting Samba for Red Hat Linux</title>
|
---|
307 | <para>
|
---|
308 | The process for starting Samba will now be outlined. Be sure to configure Samba's &smb.conf;
|
---|
309 | file before starting Samba. When configured, start Samba by executing:
|
---|
310 | <screen>
|
---|
311 | &rootprompt; service smb start
|
---|
312 | &rootprompt; service winbind start
|
---|
313 | </screen>
|
---|
314 | These steps will start &nmbd;, &smbd; and &winbindd;.
|
---|
315 | </para>
|
---|
316 |
|
---|
317 | <para>
|
---|
318 | To ensure that these services will be automatically restarted when the system is rebooted
|
---|
319 | execute:
|
---|
320 | <screen>
|
---|
321 | &rootprompt; chkconfig smb on
|
---|
322 | &rootprompt; chkconfig winbind on
|
---|
323 | </screen>
|
---|
324 | Samba will be started automatically at every system reboot.
|
---|
325 | </para>
|
---|
326 |
|
---|
327 | </sect3>
|
---|
328 |
|
---|
329 | <sect3>
|
---|
330 | <title>Starting Samba for Novell SUSE Linux</title>
|
---|
331 |
|
---|
332 | <para>
|
---|
333 | Novell SUSE Linux products automatically install all essential Samba components in a default installation.
|
---|
334 | Configure your &smb.conf; file, then execute the following to start Samba:
|
---|
335 | <screen>
|
---|
336 | &rootprompt; rcnmb start
|
---|
337 | &rootprompt; rcsmb start
|
---|
338 | &rootprompt; rcwinbind start
|
---|
339 | </screen>
|
---|
340 | Now execute these commands so that Samba will be started automatically following a system
|
---|
341 | reboot:
|
---|
342 | <screen>
|
---|
343 | &rootprompt; chkconfig nmb on
|
---|
344 | &rootprompt; chkconfig smb on
|
---|
345 | &rootprompt; chkconfig winbind on
|
---|
346 | </screen>
|
---|
347 | The Samba services will now be started automatically following a system reboot.
|
---|
348 | </para>
|
---|
349 |
|
---|
350 | </sect3>
|
---|
351 |
|
---|
352 | </sect2>
|
---|
353 |
|
---|
354 | </sect1>
|
---|
355 |
|
---|
356 | </chapter>
|
---|