summaryrefslogtreecommitdiff
path: root/docs/htmldocs/compiling.html
blob: 95c29b51938594127a272f8bb415039537964b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>How to compile SAMBA</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="SAMBA Project Documentation"
HREF="samba-howto-collection.html"><LINK
REL="UP"
TITLE="Appendixes"
HREF="appendixes.html"><LINK
REL="PREVIOUS"
TITLE="Samba and other CIFS clients"
HREF="other-clients.html"><LINK
REL="NEXT"
TITLE="Reporting Bugs"
HREF="bugreport.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SAMBA Project Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="other-clients.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="bugreport.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="COMPILING"
></A
>Chapter 23. How to compile SAMBA</H1
><P
>You can obtain the samba source from the <A
HREF="http://samba.org/"
TARGET="_top"
>samba website</A
>. To obtain a development version, 
you can download samba from CVS or using rsync. </P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN3337"
>23.1. Access Samba source code via CVS</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN3339"
>23.1.1. Introduction</A
></H2
><P
>Samba is developed in an open environment.  Developers use CVS
(Concurrent Versioning System) to "checkin" (also known as 
"commit") new source code.  Samba's various CVS branches can
be accessed via anonymous CVS using the instructions
detailed in this chapter.</P
><P
>This chapter is a modified version of the instructions found at
<A
HREF="http://samba.org/samba/cvs.html"
TARGET="_top"
>http://samba.org/samba/cvs.html</A
></P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN3344"
>23.1.2. CVS Access to samba.org</A
></H2
><P
>The machine samba.org runs a publicly accessible CVS 
repository for access to the source code of several packages, 
including samba, rsync and jitterbug. There are two main ways of 
accessing the CVS server on this host.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN3347"
>23.1.2.1. Access via CVSweb</A
></H3
><P
>You can access the source code via your 
favourite WWW browser. This allows you to access the contents of 
individual files in the repository and also to look at the revision 
history and commit logs of individual files. You can also ask for a diff 
listing between any two versions on the repository.</P
><P
>Use the URL : <A
HREF="http://samba.org/cgi-bin/cvsweb"
TARGET="_top"
>http://samba.org/cgi-bin/cvsweb</A
></P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN3352"
>23.1.2.2. Access via cvs</A
></H3
><P
>You can also access the source code via a 
normal cvs client.  This gives you much more control over you can 
do with the repository and allows you to checkout whole source trees 
and keep them up to date via normal cvs commands. This is the 
preferred method of access if you are a developer and not
just a casual browser.</P
><P
>To download the latest cvs source code, point your
browser at the URL : <A
HREF="http://www.cyclic.com/"
TARGET="_top"
>http://www.cyclic.com/</A
>.
and click on the 'How to get cvs' link. CVS is free software under 
the GNU GPL (as is Samba).  Note that there are several graphical CVS clients
which provide a graphical interface to the sometimes mundane CVS commands.
Links to theses clients are also available from http://www.cyclic.com.</P
><P
>To gain access via anonymous cvs use the following steps. 
For this example it is assumed that you want a copy of the 
samba source code. For the other source code repositories 
on this system just substitute the correct package name</P
><P
></P
><OL
TYPE="1"
><LI
><P
>	Install a recent copy of cvs. All you really need is a 
	copy of the cvs client binary. 
	</P
></LI
><LI
><P
>	Run the command 
	</P
><P
>	<B
CLASS="COMMAND"
>cvs -d :pserver:cvs@samba.org:/cvsroot login</B
>
	</P
><P
>	When it asks you for a password type <KBD
CLASS="USERINPUT"
>cvs</KBD
>.
	</P
></LI
><LI
><P
>	Run the command 
	</P
><P
>	<B
CLASS="COMMAND"
>cvs -d :pserver:cvs@samba.org:/cvsroot co samba</B
>
	</P
><P
>	This will create a directory called samba containing the 
	latest samba source code (i.e. the HEAD tagged cvs branch). This 
	currently corresponds to the 3.0 development tree. 
	</P
><P
>	CVS branches other HEAD can be obtained by using the <VAR
CLASS="PARAMETER"
>-r</VAR
>
	and defining a tag name.  A list of branch tag names can be found on the
	"Development" page of the samba web site.  A common request is to obtain the
	latest 2.2 release code.  This could be done by using the following command.
	</P
><P
>	<B
CLASS="COMMAND"
>cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_2_2 samba</B
>
	</P
></LI
><LI
><P
>	Whenever you want to merge in the latest code changes use 
	the following command from within the samba directory: 
	</P
><P
>	<B
CLASS="COMMAND"
>cvs update -d -P</B
>
	</P
></LI
></OL
></DIV
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN3380"
>23.2. Accessing the samba sources via rsync and ftp</A
></H1
><P
>	pserver.samba.org also exports unpacked copies of most parts of the CVS tree at <A
HREF="ftp://pserver.samba.org/pub/unpacked"
TARGET="_top"
>ftp://pserver.samba.org/pub/unpacked</A
> and also via anonymous rsync at rsync://pserver.samba.org/ftp/unpacked/. I recommend using rsync rather than ftp.
	See <A
HREF="http://rsync.samba.org/"
TARGET="_top"
>the rsync homepage</A
> for more info on rsync.                       
	</P
><P
>	The disadvantage of the unpacked trees
	is that they do not support automatic
	merging of local changes like CVS does.
	rsync access is most convenient for an 
	initial install.                       
	</P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN3386"
>23.3. Building the Binaries</A
></H1
><P
>To do this, first run the program <B
CLASS="COMMAND"
>./configure
	</B
> in the source directory. This should automatically 
	configure Samba for your operating system. If you have unusual 
	needs then you may wish to run</P
><P
><SAMP
CLASS="PROMPT"
>root# </SAMP
><KBD
CLASS="USERINPUT"
>./configure --help
	</KBD
></P
><P
>first to see what special options you can enable.
	Then executing</P
><P
><SAMP
CLASS="PROMPT"
>root# </SAMP
><KBD
CLASS="USERINPUT"
>make</KBD
></P
><P
>will create the binaries. Once it's successfully 
	compiled you can use </P
><P
><SAMP
CLASS="PROMPT"
>root# </SAMP
><KBD
CLASS="USERINPUT"
>make install</KBD
></P
><P
>to install the binaries and manual pages. You can 
	separately install the binaries and/or man pages using</P
><P
><SAMP
CLASS="PROMPT"
>root# </SAMP
><KBD
CLASS="USERINPUT"
>make installbin
	</KBD
></P
><P
>and</P
><P
><SAMP
CLASS="PROMPT"
>root# </SAMP
><KBD
CLASS="USERINPUT"
>make installman
	</KBD
></P
><P
>Note that if you are upgrading for a previous version 
	of Samba you might like to know that the old versions of 
	the binaries will be renamed with a ".old" extension. You 
	can go back to the previous version with</P
><P
><SAMP
CLASS="PROMPT"
>root# </SAMP
><KBD
CLASS="USERINPUT"
>make revert
	</KBD
></P
><P
>if you find this version a disaster!</P
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN3414"
>23.4. Starting the smbd and nmbd</A
></H1
><P
>You must choose to start smbd and nmbd either
	as daemons or from <B
CLASS="COMMAND"
>inetd</B
>. Don't try
	to do both!  Either you can put them in <TT
CLASS="FILENAME"
>	inetd.conf</TT
> and have them started on demand
	by <B
CLASS="COMMAND"
>inetd</B
>, or you can start them as
	daemons either from the command line or in <TT
CLASS="FILENAME"
>	/etc/rc.local</TT
>. See the man pages for details
	on the command line options. Take particular care to read
	the bit about what user you need to be in order to start
	Samba.  In many cases you must be root.</P
><P
>The main advantage of starting <B
CLASS="COMMAND"
>smbd</B
>
	and <B
CLASS="COMMAND"
>nmbd</B
> using the recommended daemon method
	is that they will respond slightly more quickly to an initial connection
	request.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN3424"
>23.4.1. Starting from inetd.conf</A
></H2
><P
>NOTE; The following will be different if 
		you use NIS, NIS+ or LDAP to distribute services maps.</P
><P
>Look at your <TT
CLASS="FILENAME"
>/etc/services</TT
>. 
		What is defined at port 139/tcp. If nothing is defined 
		then add a line like this:</P
><P
><KBD
CLASS="USERINPUT"
>netbios-ssn     139/tcp</KBD
></P
><P
>similarly for 137/udp you should have an entry like:</P
><P
><KBD
CLASS="USERINPUT"
>netbios-ns	137/udp</KBD
></P
><P
>Next edit your <TT
CLASS="FILENAME"
>/etc/inetd.conf</TT
> 
		and add two lines something like this:</P
><P
><PRE
CLASS="PROGRAMLISTING"
>		netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd 
		netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd 
		</PRE
></P
><P
>The exact syntax of <TT
CLASS="FILENAME"
>/etc/inetd.conf</TT
> 
		varies between unixes. Look at the other entries in inetd.conf 
		for a guide.</P
><P
>NOTE: Some unixes already have entries like netbios_ns 
		(note the underscore) in <TT
CLASS="FILENAME"
>/etc/services</TT
>. 
		You must either edit <TT
CLASS="FILENAME"
>/etc/services</TT
> or
		<TT
CLASS="FILENAME"
>/etc/inetd.conf</TT
> to make them consistent.</P
><P
>NOTE: On many systems you may need to use the 
		"interfaces" option in smb.conf to specify the IP address 
		and netmask of your interfaces. Run <B
CLASS="COMMAND"
>ifconfig</B
> 
		as root if you don't know what the broadcast is for your
		net. <B
CLASS="COMMAND"
>nmbd</B
> tries to determine it at run 
		time, but fails on some unixes. See the section on "testing nmbd" 
		for a method of finding if you need to do this.</P
><P
>!!!WARNING!!! Many unixes only accept around 5 
		parameters on the command line in <TT
CLASS="FILENAME"
>inetd.conf</TT
>. 
		This means you shouldn't use spaces between the options and 
		arguments, or you should use a script, and start the script 
		from <B
CLASS="COMMAND"
>inetd</B
>.</P
><P
>Restart <B
CLASS="COMMAND"
>inetd</B
>, perhaps just send 
		it a HUP. If you have installed an earlier version of <B
CLASS="COMMAND"
>		nmbd</B
> then you may need to kill nmbd as well.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN3453"
>23.4.2. Alternative: starting it as a daemon</A
></H2
><P
>To start the server as a daemon you should create 
		a script something like this one, perhaps calling 
		it <TT
CLASS="FILENAME"
>startsmb</TT
>.</P
><P
><PRE
CLASS="PROGRAMLISTING"
>		#!/bin/sh
		/usr/local/samba/bin/smbd -D 
		/usr/local/samba/bin/nmbd -D 
		</PRE
></P
><P
>then make it executable with <B
CLASS="COMMAND"
>chmod 
		+x startsmb</B
></P
><P
>You can then run <B
CLASS="COMMAND"
>startsmb</B
> by 
		hand or execute it from <TT
CLASS="FILENAME"
>/etc/rc.local</TT
>
		</P
><P
>To kill it send a kill signal to the processes 
		<B
CLASS="COMMAND"
>nmbd</B
> and <B
CLASS="COMMAND"
>smbd</B
>.</P
><P
>NOTE: If you use the SVR4 style init system then 
		you may like to look at the <TT
CLASS="FILENAME"
>examples/svr4-startup</TT
>
		script to make Samba fit into that system.</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="other-clients.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="samba-howto-collection.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="bugreport.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Samba and other CIFS clients</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="appendixes.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Reporting Bugs</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>