summaryrefslogtreecommitdiff
path: root/docs/htmldocs/compiling.html
blob: c387dd72fb9fe81469b880082a6b564039715d10 (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
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
<!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 31. 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="AEN4453"
>31.1. Access Samba source code via CVS</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN4455"
>31.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="AEN4460"
>31.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="AEN4463"
>31.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="AEN4468"
>31.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
>	<KBD
CLASS="USERINPUT"
>cvs -d :pserver:cvs@samba.org:/cvsroot login</KBD
>
	</P
><P
>	When it asks you for a password type <KBD
CLASS="USERINPUT"
>cvs</KBD
>.
	</P
></LI
><LI
><P
>	Run the command 
	</P
><P
>	<KBD
CLASS="USERINPUT"
>cvs -d :pserver:cvs@samba.org:/cvsroot co samba</KBD
>
	</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 userinput.
	</P
><P
>	<KBD
CLASS="USERINPUT"
>cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_2_2 samba</KBD
>
	</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
>	<KBD
CLASS="USERINPUT"
>cvs update -d -P</KBD
>
	</P
></LI
></OL
></DIV
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN4496"
>31.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="AEN4502"
>31.3. Building the Binaries</A
></H1
><P
>To do this, first run the program <KBD
CLASS="USERINPUT"
>./configure
	</KBD
> 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
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN4530"
>31.3.1. Compiling samba with Active Directory support</A
></H2
><P
>In order to compile samba with ADS support, you need to have installed
	on your system: 
	<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
>the MIT kerberos development libraries (either install from the sources or use a package). The heimdal libraries will not work.</TD
></TR
><TR
><TD
>the OpenLDAP development libraries.</TD
></TR
></TBODY
></TABLE
><P
></P
>

	</P
><P
>If your kerberos libraries are in a non-standard location then
	  remember to add the configure option --with-krb5=DIR.</P
><P
>After you run configure make sure that <TT
CLASS="FILENAME"
>include/config.h</TT
> it generates contains lines like this:</P
><P
><PRE
CLASS="PROGRAMLISTING"
>#define HAVE_KRB5 1
#define HAVE_LDAP 1
		  </PRE
></P
><P
>If it doesn't then configure did not find your krb5 libraries or
	    your ldap libraries. Look in config.log to figure out why and fix
		  it.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN4542"
>31.3.1.1. Installing the required packages for Debian</A
></H3
><P
>On Debian you need to install the following packages:</P
><P
>	<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
>libkrb5-dev</TD
></TR
><TR
><TD
>krb5-user</TD
></TR
></TBODY
></TABLE
><P
></P
>
	</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN4549"
>31.3.1.2. Installing the required packages for RedHat</A
></H3
><P
>On RedHat this means you should have at least: </P
><P
>	<P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
>krb5-workstation (for kinit)</TD
></TR
><TR
><TD
>krb5-libs (for linking with)</TD
></TR
><TR
><TD
>krb5-devel (because you are compiling from source)</TD
></TR
></TBODY
></TABLE
><P
></P
>
	</P
><P
>in addition to the standard development environment.</P
><P
>Note that these are not standard on a RedHat install, and you may need
	to get them off CD2.</P
></DIV
></DIV
></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN4559"
>31.4. Starting the smbd and nmbd</A
></H1
><P
>You must choose to start smbd and nmbd either
	as daemons or from <SPAN
CLASS="APPLICATION"
>inetd</SPAN
>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 <SPAN
CLASS="APPLICATION"
>inetd</SPAN
>, 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 <SPAN
CLASS="APPLICATION"
>smbd</SPAN
>
	and <SPAN
CLASS="APPLICATION"
>nmbd</SPAN
> 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="AEN4569"
>31.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
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>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
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>On many systems you may need to use the 
		<B
CLASS="COMMAND"
>interfaces</B
> option in <TT
CLASS="FILENAME"
>smb.conf</TT
> to specify the IP address 
		and netmask of your interfaces. Run <SPAN
CLASS="APPLICATION"
>ifconfig</SPAN
> 
		as root if you don't know what the broadcast is for your
		net. <SPAN
CLASS="APPLICATION"
>nmbd</SPAN
> tries to determine it at run 
		time, but fails on some unixes. 
		</P
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="WARNING"
><P
></P
><TABLE
CLASS="WARNING"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/warning.gif"
HSPACE="5"
ALT="Warning"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>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
></TD
></TR
></TABLE
></DIV
><P
>Restart <B
CLASS="COMMAND"
>inetd</B
>, perhaps just send 
		it a HUP. If you have installed an earlier version of <SPAN
CLASS="APPLICATION"
>		nmbd</SPAN
> then you may need to kill nmbd as well.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN4603"
>31.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
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>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
></TD
></TR
></TABLE
></DIV
></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
>