Fix compiler warnings for vfstest. Patch from Stefan Metzmacher <mezte@metzemix.de>
[Samba/gebeck_regimport.git] / docs / htmldocs / install.html
blob0ba79dbe26cb34db05da0361aae5d8645775f4ce
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >How to Install and Test SAMBA</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
9 "><LINK
10 REL="HOME"
11 TITLE="SAMBA Project Documentation"
12 HREF="samba-howto-collection.html"><LINK
13 REL="UP"
14 TITLE="General installation"
15 HREF="introduction.html"><LINK
16 REL="PREVIOUS"
17 TITLE="General installation"
18 HREF="introduction.html"><LINK
19 REL="NEXT"
20 TITLE="Improved browsing in samba"
21 HREF="improved-browsing.html"></HEAD
22 ><BODY
23 CLASS="CHAPTER"
24 BGCOLOR="#FFFFFF"
25 TEXT="#000000"
26 LINK="#0000FF"
27 VLINK="#840084"
28 ALINK="#0000FF"
29 ><DIV
30 CLASS="NAVHEADER"
31 ><TABLE
32 SUMMARY="Header navigation table"
33 WIDTH="100%"
34 BORDER="0"
35 CELLPADDING="0"
36 CELLSPACING="0"
37 ><TR
38 ><TH
39 COLSPAN="3"
40 ALIGN="center"
41 >SAMBA Project Documentation</TH
42 ></TR
43 ><TR
44 ><TD
45 WIDTH="10%"
46 ALIGN="left"
47 VALIGN="bottom"
48 ><A
49 HREF="introduction.html"
50 ACCESSKEY="P"
51 >Prev</A
52 ></TD
53 ><TD
54 WIDTH="80%"
55 ALIGN="center"
56 VALIGN="bottom"
57 ></TD
58 ><TD
59 WIDTH="10%"
60 ALIGN="right"
61 VALIGN="bottom"
62 ><A
63 HREF="improved-browsing.html"
64 ACCESSKEY="N"
65 >Next</A
66 ></TD
67 ></TR
68 ></TABLE
69 ><HR
70 ALIGN="LEFT"
71 WIDTH="100%"></DIV
72 ><DIV
73 CLASS="CHAPTER"
74 ><H1
75 ><A
76 NAME="INSTALL">Chapter 1. How to Install and Test SAMBA</H1
77 ><DIV
78 CLASS="SECT1"
79 ><H1
80 CLASS="SECT1"
81 ><A
82 NAME="AEN26">1.1. Read the man pages</H1
83 ><P
84 >The man pages distributed with SAMBA contain
85 lots of useful info that will help to get you started.
86 If you don't know how to read man pages then try
87 something like:</P
88 ><P
89 ><TT
90 CLASS="PROMPT"
91 >$ </TT
92 ><TT
93 CLASS="USERINPUT"
94 ><B
95 >man smbd.8</B
96 ></TT
98 or
99 <TT
100 CLASS="PROMPT"
101 >$ </TT
102 ><TT
103 CLASS="USERINPUT"
105 >nroff -man smbd.8 | more
107 ></TT
108 > on older unixes.</P
110 >Other sources of information are pointed to
111 by the Samba web site,<A
112 HREF="http://www.samba.org/"
113 TARGET="_top"
114 > http://www.samba.org</A
115 ></P
116 ></DIV
117 ><DIV
118 CLASS="SECT1"
119 ><H1
120 CLASS="SECT1"
122 NAME="AEN36">1.2. Building the Binaries</H1
124 >To do this, first run the program <B
125 CLASS="COMMAND"
126 >./configure
128 > in the source directory. This should automatically
129 configure Samba for your operating system. If you have unusual
130 needs then you may wish to run</P
132 ><TT
133 CLASS="PROMPT"
134 >root# </TT
135 ><TT
136 CLASS="USERINPUT"
138 >./configure --help
140 ></TT
141 ></P
143 >first to see what special options you can enable.
144 Then executing</P
146 ><TT
147 CLASS="PROMPT"
148 >root# </TT
149 ><TT
150 CLASS="USERINPUT"
152 >make</B
153 ></TT
154 ></P
156 >will create the binaries. Once it's successfully
157 compiled you can use </P
159 ><TT
160 CLASS="PROMPT"
161 >root# </TT
162 ><TT
163 CLASS="USERINPUT"
165 >make install</B
166 ></TT
167 ></P
169 >to install the binaries and manual pages. You can
170 separately install the binaries and/or man pages using</P
172 ><TT
173 CLASS="PROMPT"
174 >root# </TT
175 ><TT
176 CLASS="USERINPUT"
178 >make installbin
180 ></TT
181 ></P
183 >and</P
185 ><TT
186 CLASS="PROMPT"
187 >root# </TT
188 ><TT
189 CLASS="USERINPUT"
191 >make installman
193 ></TT
194 ></P
196 >Note that if you are upgrading for a previous version
197 of Samba you might like to know that the old versions of
198 the binaries will be renamed with a ".old" extension. You
199 can go back to the previous version with</P
201 ><TT
202 CLASS="PROMPT"
203 >root# </TT
204 ><TT
205 CLASS="USERINPUT"
207 >make revert
209 ></TT
210 ></P
212 >if you find this version a disaster!</P
213 ></DIV
214 ><DIV
215 CLASS="SECT1"
216 ><H1
217 CLASS="SECT1"
219 NAME="AEN64">1.3. The all important step</H1
221 >At this stage you must fetch yourself a
222 coffee or other drink you find stimulating. Getting the rest
223 of the install right can sometimes be tricky, so you will
224 probably need it.</P
226 >If you have installed samba before then you can skip
227 this step.</P
228 ></DIV
229 ><DIV
230 CLASS="SECT1"
231 ><H1
232 CLASS="SECT1"
234 NAME="AEN68">1.4. Create the smb configuration file.</H1
236 >There are sample configuration files in the examples
237 subdirectory in the distribution. I suggest you read them
238 carefully so you can see how the options go together in
239 practice. See the man page for all the options.</P
241 >The simplest useful configuration file would be
242 something like this:</P
244 ><PRE
245 CLASS="PROGRAMLISTING"
246 > [global]
247 workgroup = MYGROUP
249 [homes]
250 guest ok = no
251 read only = no
252 </PRE
253 ></P
255 >which would allow connections by anyone with an
256 account on the server, using either their login name or
257 "homes" as the service name. (Note that I also set the
258 workgroup that Samba is part of. See BROWSING.txt for details)</P
260 >Note that <B
261 CLASS="COMMAND"
262 >make install</B
263 > will not install
264 a <TT
265 CLASS="FILENAME"
266 >smb.conf</TT
267 > file. You need to create it
268 yourself. </P
270 >Make sure you put the smb.conf file in the same place
271 you specified in the<TT
272 CLASS="FILENAME"
273 >Makefile</TT
274 > (the default is to
275 look for it in <TT
276 CLASS="FILENAME"
277 >/usr/local/samba/lib/</TT
278 >).</P
280 >For more information about security settings for the
281 [homes] share please refer to the document UNIX_SECURITY.txt.</P
282 ></DIV
283 ><DIV
284 CLASS="SECT1"
285 ><H1
286 CLASS="SECT1"
288 NAME="AEN82">1.5. Test your config file with
290 CLASS="COMMAND"
291 >testparm</B
292 ></H1
294 >It's important that you test the validity of your
296 CLASS="FILENAME"
297 >smb.conf</TT
298 > file using the testparm program.
299 If testparm runs OK then it will list the loaded services. If
300 not it will give an error message.</P
302 >Make sure it runs OK and that the services look
303 reasonable before proceeding. </P
305 >Always run testparm again when you change
307 CLASS="FILENAME"
308 >smb.conf</TT
309 >!</P
310 ></DIV
311 ><DIV
312 CLASS="SECT1"
313 ><H1
314 CLASS="SECT1"
316 NAME="AEN90">1.6. Starting the smbd and nmbd</H1
318 >You must choose to start smbd and nmbd either
319 as daemons or from <B
320 CLASS="COMMAND"
321 >inetd</B
322 >. Don't try
323 to do both! Either you can put them in <TT
324 CLASS="FILENAME"
325 > inetd.conf</TT
326 > and have them started on demand
327 by <B
328 CLASS="COMMAND"
329 >inetd</B
330 >, or you can start them as
331 daemons either from the command line or in <TT
332 CLASS="FILENAME"
333 > /etc/rc.local</TT
334 >. See the man pages for details
335 on the command line options. Take particular care to read
336 the bit about what user you need to be in order to start
337 Samba. In many cases you must be root.</P
339 >The main advantage of starting <B
340 CLASS="COMMAND"
341 >smbd</B
343 and <B
344 CLASS="COMMAND"
345 >nmbd</B
346 > using the recommended daemon method
347 is that they will respond slightly more quickly to an initial connection
348 request.</P
349 ><DIV
350 CLASS="SECT2"
351 ><H2
352 CLASS="SECT2"
354 NAME="AEN100">1.6.1. Starting from inetd.conf</H2
356 >NOTE; The following will be different if
357 you use NIS or NIS+ to distributed services maps.</P
359 >Look at your <TT
360 CLASS="FILENAME"
361 >/etc/services</TT
363 What is defined at port 139/tcp. If nothing is defined
364 then add a line like this:</P
366 ><TT
367 CLASS="USERINPUT"
369 >netbios-ssn 139/tcp</B
370 ></TT
371 ></P
373 >similarly for 137/udp you should have an entry like:</P
375 ><TT
376 CLASS="USERINPUT"
378 >netbios-ns 137/udp</B
379 ></TT
380 ></P
382 >Next edit your <TT
383 CLASS="FILENAME"
384 >/etc/inetd.conf</TT
386 and add two lines something like this:</P
388 ><PRE
389 CLASS="PROGRAMLISTING"
390 > netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
391 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
392 </PRE
393 ></P
395 >The exact syntax of <TT
396 CLASS="FILENAME"
397 >/etc/inetd.conf</TT
399 varies between unixes. Look at the other entries in inetd.conf
400 for a guide.</P
402 >NOTE: Some unixes already have entries like netbios_ns
403 (note the underscore) in <TT
404 CLASS="FILENAME"
405 >/etc/services</TT
407 You must either edit <TT
408 CLASS="FILENAME"
409 >/etc/services</TT
410 > or
412 CLASS="FILENAME"
413 >/etc/inetd.conf</TT
414 > to make them consistent.</P
416 >NOTE: On many systems you may need to use the
417 "interfaces" option in smb.conf to specify the IP address
418 and netmask of your interfaces. Run <B
419 CLASS="COMMAND"
420 >ifconfig</B
422 as root if you don't know what the broadcast is for your
423 net. <B
424 CLASS="COMMAND"
425 >nmbd</B
426 > tries to determine it at run
427 time, but fails on some unixes. See the section on "testing nmbd"
428 for a method of finding if you need to do this.</P
430 >!!!WARNING!!! Many unixes only accept around 5
431 parameters on the command line in <TT
432 CLASS="FILENAME"
433 >inetd.conf</TT
435 This means you shouldn't use spaces between the options and
436 arguments, or you should use a script, and start the script
437 from <B
438 CLASS="COMMAND"
439 >inetd</B
440 >.</P
442 >Restart <B
443 CLASS="COMMAND"
444 >inetd</B
445 >, perhaps just send
446 it a HUP. If you have installed an earlier version of <B
447 CLASS="COMMAND"
448 > nmbd</B
449 > then you may need to kill nmbd as well.</P
450 ></DIV
451 ><DIV
452 CLASS="SECT2"
453 ><H2
454 CLASS="SECT2"
456 NAME="AEN129">1.6.2. Alternative: starting it as a daemon</H2
458 >To start the server as a daemon you should create
459 a script something like this one, perhaps calling
460 it <TT
461 CLASS="FILENAME"
462 >startsmb</TT
463 >.</P
465 ><PRE
466 CLASS="PROGRAMLISTING"
467 > #!/bin/sh
468 /usr/local/samba/bin/smbd -D
469 /usr/local/samba/bin/nmbd -D
470 </PRE
471 ></P
473 >then make it executable with <B
474 CLASS="COMMAND"
475 >chmod
476 +x startsmb</B
477 ></P
479 >You can then run <B
480 CLASS="COMMAND"
481 >startsmb</B
482 > by
483 hand or execute it from <TT
484 CLASS="FILENAME"
485 >/etc/rc.local</TT
489 >To kill it send a kill signal to the processes
491 CLASS="COMMAND"
492 >nmbd</B
493 > and <B
494 CLASS="COMMAND"
495 >smbd</B
496 >.</P
498 >NOTE: If you use the SVR4 style init system then
499 you may like to look at the <TT
500 CLASS="FILENAME"
501 >examples/svr4-startup</TT
503 script to make Samba fit into that system.</P
504 ></DIV
505 ></DIV
506 ><DIV
507 CLASS="SECT1"
508 ><H1
509 CLASS="SECT1"
511 NAME="AEN145">1.7. Try listing the shares available on your
512 server</H1
514 ><TT
515 CLASS="PROMPT"
516 >$ </TT
517 ><TT
518 CLASS="USERINPUT"
520 >smbclient -L
522 CLASS="REPLACEABLE"
524 >yourhostname</I
525 ></TT
526 ></B
527 ></TT
528 ></P
530 >You should get back a list of shares available on
531 your server. If you don't then something is incorrectly setup.
532 Note that this method can also be used to see what shares
533 are available on other LanManager clients (such as WfWg).</P
535 >If you choose user level security then you may find
536 that Samba requests a password before it will list the shares.
537 See the <B
538 CLASS="COMMAND"
539 >smbclient</B
540 > man page for details. (you
541 can force it to list the shares without a password by
542 adding the option -U% to the command line. This will not work
543 with non-Samba servers)</P
544 ></DIV
545 ><DIV
546 CLASS="SECT1"
547 ><H1
548 CLASS="SECT1"
550 NAME="AEN154">1.8. Try connecting with the unix client</H1
552 ><TT
553 CLASS="PROMPT"
554 >$ </TT
555 ><TT
556 CLASS="USERINPUT"
558 >smbclient <TT
559 CLASS="REPLACEABLE"
561 > //yourhostname/aservice</I
562 ></TT
563 ></B
564 ></TT
565 ></P
567 >Typically the <TT
568 CLASS="REPLACEABLE"
570 >yourhostname</I
571 ></TT
573 would be the name of the host where you installed <B
574 CLASS="COMMAND"
575 > smbd</B
576 >. The <TT
577 CLASS="REPLACEABLE"
579 >aservice</I
580 ></TT
581 > is
582 any service you have defined in the <TT
583 CLASS="FILENAME"
584 >smb.conf</TT
586 file. Try your user name if you just have a [homes] section
587 in <TT
588 CLASS="FILENAME"
589 >smb.conf</TT
590 >.</P
592 >For example if your unix host is bambi and your login
593 name is fred you would type:</P
595 ><TT
596 CLASS="PROMPT"
597 >$ </TT
598 ><TT
599 CLASS="USERINPUT"
601 >smbclient //bambi/fred
603 ></TT
604 ></P
605 ></DIV
606 ><DIV
607 CLASS="SECT1"
608 ><H1
609 CLASS="SECT1"
611 NAME="AEN170">1.9. Try connecting from a DOS, WfWg, Win9x, WinNT,
612 Win2k, OS/2, etc... client</H1
614 >Try mounting disks. eg:</P
616 ><TT
617 CLASS="PROMPT"
618 >C:\WINDOWS\&#62; </TT
619 ><TT
620 CLASS="USERINPUT"
622 >net use d: \\servername\service
624 ></TT
625 ></P
627 >Try printing. eg:</P
629 ><TT
630 CLASS="PROMPT"
631 >C:\WINDOWS\&#62; </TT
632 ><TT
633 CLASS="USERINPUT"
635 >net use lpt1:
636 \\servername\spoolservice</B
637 ></TT
638 ></P
640 ><TT
641 CLASS="PROMPT"
642 >C:\WINDOWS\&#62; </TT
643 ><TT
644 CLASS="USERINPUT"
646 >print filename
648 ></TT
649 ></P
651 >Celebrate, or send me a bug report!</P
652 ></DIV
653 ><DIV
654 CLASS="SECT1"
655 ><H1
656 CLASS="SECT1"
658 NAME="AEN184">1.10. What If Things Don't Work?</H1
660 >If nothing works and you start to think "who wrote
661 this pile of trash" then I suggest you do step 2 again (and
662 again) till you calm down.</P
664 >Then you might read the file DIAGNOSIS.txt and the
665 FAQ. If you are still stuck then try the mailing list or
666 newsgroup (look in the README for details). Samba has been
667 successfully installed at thousands of sites worldwide, so maybe
668 someone else has hit your problem and has overcome it. You could
669 also use the WWW site to scan back issues of the samba-digest.</P
671 >When you fix the problem PLEASE send me some updates to the
672 documentation (or source code) so that the next person will find it
673 easier. </P
674 ><DIV
675 CLASS="SECT2"
676 ><H2
677 CLASS="SECT2"
679 NAME="AEN189">1.10.1. Diagnosing Problems</H2
681 >If you have installation problems then go to the
683 HREF="Diagnosis.html"
684 TARGET="_top"
685 >Diagnosis</A
686 > chapter to try to find the
687 problem.</P
688 ></DIV
689 ><DIV
690 CLASS="SECT2"
691 ><H2
692 CLASS="SECT2"
694 NAME="AEN193">1.10.2. Scope IDs</H2
696 >By default Samba uses a blank scope ID. This means
697 all your windows boxes must also have a blank scope ID.
698 If you really want to use a non-blank scope ID then you will
699 need to use the 'netbios scope' smb.conf option.
700 All your PCs will need to have the same setting for
701 this to work. I do not recommend scope IDs.</P
702 ></DIV
703 ><DIV
704 CLASS="SECT2"
705 ><H2
706 CLASS="SECT2"
708 NAME="AEN196">1.10.3. Choosing the Protocol Level</H2
710 >The SMB protocol has many dialects. Currently
711 Samba supports 5, called CORE, COREPLUS, LANMAN1,
712 LANMAN2 and NT1.</P
714 >You can choose what maximum protocol to support
715 in the <TT
716 CLASS="FILENAME"
717 >smb.conf</TT
718 > file. The default is
719 NT1 and that is the best for the vast majority of sites.</P
721 >In older versions of Samba you may have found it
722 necessary to use COREPLUS. The limitations that led to
723 this have mostly been fixed. It is now less likely that you
724 will want to use less than LANMAN1. The only remaining advantage
725 of COREPLUS is that for some obscure reason WfWg preserves
726 the case of passwords in this protocol, whereas under LANMAN1,
727 LANMAN2 or NT1 it uppercases all passwords before sending them,
728 forcing you to use the "password level=" option in some cases.</P
730 >The main advantage of LANMAN2 and NT1 is support for
731 long filenames with some clients (eg: smbclient, Windows NT
732 or Win95). </P
734 >See the smb.conf(5) manual page for more details.</P
736 >Note: To support print queue reporting you may find
737 that you have to use TCP/IP as the default protocol under
738 WfWg. For some reason if you leave Netbeui as the default
739 it may break the print queue reporting on some systems.
740 It is presumably a WfWg bug.</P
741 ></DIV
742 ><DIV
743 CLASS="SECT2"
744 ><H2
745 CLASS="SECT2"
747 NAME="AEN205">1.10.4. Printing from UNIX to a Client PC</H2
749 >To use a printer that is available via a smb-based
750 server from a unix host with LPR you will need to compile the
751 smbclient program. You then need to install the script
752 "smbprint". Read the instruction in smbprint for more details.
755 >There is also a SYSV style script that does much
756 the same thing called smbprint.sysv. It contains instructions.</P
758 >See the CUPS manual for information about setting up
759 printing from a unix host with CUPS to a smb-based server. </P
760 ></DIV
761 ><DIV
762 CLASS="SECT2"
763 ><H2
764 CLASS="SECT2"
766 NAME="AEN210">1.10.5. Locking</H2
768 >One area which sometimes causes trouble is locking.</P
770 >There are two types of locking which need to be
771 performed by a SMB server. The first is "record locking"
772 which allows a client to lock a range of bytes in a open file.
773 The second is the "deny modes" that are specified when a file
774 is open.</P
776 >Record locking semantics under Unix is very
777 different from record locking under Windows. Versions
778 of Samba before 2.2 have tried to use the native
779 fcntl() unix system call to implement proper record
780 locking between different Samba clients. This can not
781 be fully correct due to several reasons. The simplest
782 is the fact that a Windows client is allowed to lock a
783 byte range up to 2^32 or 2^64, depending on the client
784 OS. The unix locking only supports byte ranges up to
785 2^31. So it is not possible to correctly satisfy a
786 lock request above 2^31. There are many more
787 differences, too many to be listed here.</P
789 >Samba 2.2 and above implements record locking
790 completely independent of the underlying unix
791 system. If a byte range lock that the client requests
792 happens to fall into the range 0-2^31, Samba hands
793 this request down to the Unix system. All other locks
794 can not be seen by unix anyway.</P
796 >Strictly a SMB server should check for locks before
797 every read and write call on a file. Unfortunately with the
798 way fcntl() works this can be slow and may overstress the
799 rpc.lockd. It is also almost always unnecessary as clients
800 are supposed to independently make locking calls before reads
801 and writes anyway if locking is important to them. By default
802 Samba only makes locking calls when explicitly asked
803 to by a client, but if you set "strict locking = yes" then it will
804 make lock checking calls on every read and write. </P
806 >You can also disable by range locking completely
807 using "locking = no". This is useful for those shares that
808 don't support locking or don't need it (such as cdroms). In
809 this case Samba fakes the return codes of locking calls to
810 tell clients that everything is OK.</P
812 >The second class of locking is the "deny modes". These
813 are set by an application when it opens a file to determine
814 what types of access should be allowed simultaneously with
815 its open. A client may ask for DENY_NONE, DENY_READ, DENY_WRITE
816 or DENY_ALL. There are also special compatibility modes called
817 DENY_FCB and DENY_DOS.</P
818 ></DIV
819 ><DIV
820 CLASS="SECT2"
821 ><H2
822 CLASS="SECT2"
824 NAME="AEN219">1.10.6. Mapping Usernames</H2
826 >If you have different usernames on the PCs and
827 the unix server then take a look at the "username map" option.
828 See the smb.conf man page for details.</P
829 ></DIV
830 ></DIV
831 ></DIV
832 ><DIV
833 CLASS="NAVFOOTER"
834 ><HR
835 ALIGN="LEFT"
836 WIDTH="100%"><TABLE
837 SUMMARY="Footer navigation table"
838 WIDTH="100%"
839 BORDER="0"
840 CELLPADDING="0"
841 CELLSPACING="0"
842 ><TR
843 ><TD
844 WIDTH="33%"
845 ALIGN="left"
846 VALIGN="top"
848 HREF="introduction.html"
849 ACCESSKEY="P"
850 >Prev</A
851 ></TD
852 ><TD
853 WIDTH="34%"
854 ALIGN="center"
855 VALIGN="top"
857 HREF="samba-howto-collection.html"
858 ACCESSKEY="H"
859 >Home</A
860 ></TD
861 ><TD
862 WIDTH="33%"
863 ALIGN="right"
864 VALIGN="top"
866 HREF="improved-browsing.html"
867 ACCESSKEY="N"
868 >Next</A
869 ></TD
870 ></TR
871 ><TR
872 ><TD
873 WIDTH="33%"
874 ALIGN="left"
875 VALIGN="top"
876 >General installation</TD
877 ><TD
878 WIDTH="34%"
879 ALIGN="center"
880 VALIGN="top"
882 HREF="introduction.html"
883 ACCESSKEY="U"
884 >Up</A
885 ></TD
886 ><TD
887 WIDTH="33%"
888 ALIGN="right"
889 VALIGN="top"
890 >Improved browsing in samba</TD
891 ></TR
892 ></TABLE
893 ></DIV
894 ></BODY
895 ></HTML