This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[samba.git] / docs / htmldocs / compiling.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 36. How to Compile Samba</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"><link rel="home" href="index.html" title="SAMBA Project Documentation"><link rel="up" href="Appendixes.html" title="Part VI. Appendixes"><link rel="previous" href="Appendixes.html" title="Part VI. Appendixes"><link rel="next" href="Portability.html" title="Chapter 37. Portability"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 36. How to Compile Samba</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="Appendixes.html">Prev</a> </td><th width="60%" align="center">Part VI. Appendixes</th><td width="20%" align="right"> <a accesskey="n" href="Portability.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="compiling"></a>Chapter 36. How to Compile Samba</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Andrew</span> <span class="surname">Tridgell</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate"> 22 May 2001 </p></div><div><p class="pubdate"> 18 March 2003 </p></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="compiling.html#id2972995">Access Samba Source Code via CVS</a></dt><dd><dl><dt><a href="compiling.html#id2973003">Introduction</a></dt><dt><a href="compiling.html#id2973049">CVS Access to samba.org</a></dt></dl></dd><dt><a href="compiling.html#id2973311">Accessing the Samba Sources via rsync and ftp</a></dt><dt><a href="compiling.html#id2973389">Verifying Samba's PGP Signature</a></dt><dt><a href="compiling.html#id2973553">Building the Binaries</a></dt><dd><dl><dt><a href="compiling.html#id2973768">Compiling Samba with Active Directory Support</a></dt></dl></dd><dt><a href="compiling.html#id2973958">Starting the smbd and nmbd</a></dt><dd><dl><dt><a href="compiling.html#id2974066">Starting from inetd.conf</a></dt><dt><a href="compiling.html#id2974312">Alternative: Starting smbd as a Daemon</a></dt></dl></dd></dl></div><p>
2 You can obtain the Samba source from the
3 <ulink url="http://samba.org/">Samba Website.</ulink> To obtain a development version, 
4 you can download Samba from CVS or using <b class="command">rsync</b>.
5 </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2972995"></a>Access Samba Source Code via CVS</h2></div></div><div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2973003"></a>Introduction</h3></div></div><div></div></div><p>
6 <a class="indexterm" name="id2973014"></a>
7 Samba is developed in an open environment. Developers use
8 Concurrent Versioning System (CVS) to &#8220;<span class="quote">checkin</span>&#8221; (also known as 
9 &#8220;<span class="quote">commit</span>&#8221;) new source code. Samba's various CVS branches can
10 be accessed via anonymous CVS using the instructions
11 detailed in this chapter.
12 </p><p>
13 This chapter is a modified version of the instructions found at
14 <ulink url="http://samba.org/samba/cvs.html">http://samba.org/samba/cvs.html</ulink>
15 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2973049"></a>CVS Access to samba.org</h3></div></div><div></div></div><p>
16 The machine samba.org runs a publicly accessible CVS 
17 repository for access to the source code of several packages, 
18 including Samba, rsync, distcc, ccache, and jitterbug. There are two main ways
19 of accessing the CVS server on this host:
20 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2973065"></a>Access via CVSweb</h4></div></div><div></div></div><p>
21 <a class="indexterm" name="id2973076"></a>
22 You can access the source code via your favorite WWW browser. This allows you to access
23 the contents of individual files in the repository and also to look at the revision 
24 history and commit logs of individual files. You can also ask for a diff 
25 listing between any two versions on the repository.
26 </p><p>
27 Use the URL:
28 <ulink url="http://samba.org/cgi-bin/CVSweb">http://samba.org/cgi-bin/CVSweb</ulink>
29 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2973106"></a>Access via CVS</h4></div></div><div></div></div><p>
30 You can also access the source code via a 
31 normal CVS client. This gives you much more control over what you can 
32 do with the repository and allows you to checkout whole source trees 
33 and keep them up-to-date via normal CVS commands. This is the 
34 preferred method of access if you are a developer and not
35 just a casual browser.
36 </p><p>
37 To download the latest CVS source code, point your
38 browser at the URL :
39 <ulink url="http://www.cyclic.com/">http://www.cyclic.com/</ulink>.
40 and click on the &#8220;<span class="quote">How to get CVS</span>&#8221; link. CVS is free software under 
41 the GNU GPL (as is Samba). Note that there are several graphical CVS clients
42 that provide a graphical interface to the sometimes mundane CVS commands.
43 Links to theses clients are also available from the Cyclic Web site.
44 </p><p>
45 To gain access via anonymous CVS, use the following steps. 
46 For this example it is assumed that you want a copy of the 
47 Samba source code. For the other source code repositories 
48 on this system just substitute the correct package name.
49 </p><div class="procedure"><p class="title"><b>Procedure 36.1. Retrieving Samba using CVS</b></p><ol type="1"><li><p>
50         Install a recent copy of CVS. All you really need is a 
51         copy of the CVS client binary. 
52         </p></li><li><p>
53         Run the command:
54         </p><p>
55         <b class="userinput"><tt>cvs -d :pserver:cvs@samba.org:/cvsroot login</tt></b>
56         </p></li><li><p>
57         When it asks you for a password, type <b class="userinput"><tt>cvs</tt></b>.
58         </p></li><li><p>
59         Run the command 
60         </p><p>
61         <b class="userinput"><tt>cvs -d :pserver:CVS@samba.org:/cvsroot co samba</tt></b>.
62         </p><p>
63         This will create a directory called <tt class="filename">samba</tt> containing the 
64         latest Samba source code (i.e., the HEAD tagged CVS branch). This 
65         currently corresponds to the 3.0 development tree. 
66         </p><p>
67         CVS branches other then HEAD can be obtained by using the
68         <tt class="option">-r</tt> and defining a tag name. A list of branch tag names 
69         can be found on the &#8220;<span class="quote">Development</span>&#8221; page of the Samba Web site. A common
70         request is to obtain the latest 3.0 release code. This could be done by 
71         using the following command:
72         </p><p>
73         <b class="userinput"><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_3_0 samba</tt></b>.
74         </p></li><li><p>
75         Whenever you want to merge in the latest code changes, use 
76         the following command from within the Samba directory: 
77         </p><p>
78         <b class="userinput"><tt>cvs update -d -P</tt></b>
79         </p></li></ol></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2973311"></a>Accessing the Samba Sources via rsync and ftp</h2></div></div><div></div></div><p>
80         <a class="indexterm" name="id2973323"></a>
81         <a class="indexterm" name="id2973331"></a>
82         <i class="parameter"><tt>pserver.samba.org</tt></i> also exports unpacked copies of most parts of the CVS
83         tree at <ulink url="ftp://pserver.samba.org/pub/unpacked">ftp://pserver.samba.org/pub/unpacked</ulink> and also via anonymous rsync at 
84         <ulink url="rsync://pserver.samba.org/ftp/unpacked/">rsync://pserver.samba.org/ftp/unpacked/</ulink>. I recommend using rsync rather than ftp.
85         See <ulink url="http://rsync.samba.org/">the rsync homepage</ulink> for more info on rsync.                      
86         </p><p>
87         The disadvantage of the unpacked trees is that they do not support automatic
88         merging of local changes like CVS does. <b class="command">rsync</b> access is most convenient 
89         for an initial install.                      
90         </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2973389"></a>Verifying Samba's PGP Signature</h2></div></div><div></div></div><p>
91 <a class="indexterm" name="id2973401"></a>
92 It is strongly recommended that you verify the PGP signature for any source file before
93 installing it. Even if you're not downloading from a mirror site, verifying PGP signatures
94 should be a standard reflex. Many people today use the GNU GPG toolset in place of PGP.
95 GPG can substitute for PGP.
96 </p><p>
97 With that said, go ahead and download the following files:
98 </p><pre class="screen">
99 <tt class="prompt">$ </tt><b class="userinput"><tt>wget http://us1.samba.org/samba/ftp/samba-2.2.8a.tar.asc</tt></b>
100 <tt class="prompt">$ </tt><b class="userinput"><tt>wget http://us1.samba.org/samba/ftp/samba-pubkey.asc</tt></b>
101 </pre><p>
102 <a class="indexterm" name="id2973459"></a>
103 The first file is the PGP signature for the Samba source file; the other is the Samba public
104 PGP key itself. Import the public PGP key with:
105 </p><pre class="screen">
106 <tt class="prompt">$ </tt><b class="userinput"><tt>gpg --import samba-pubkey.asc</tt></b>
107 </pre><p>
108 and verify the Samba source code integrity with:
109 </p><pre class="screen">
110 <tt class="prompt">$ </tt><b class="userinput"><tt>gzip -d samba-2.2.8a.tar.gz</tt></b>
111 <tt class="prompt">$ </tt><b class="userinput"><tt>gpg --verify samba-2.2.8a.tar.asc</tt></b>
112 </pre><p>
113 If you receive a message like, &#8220;<span class="quote">Good signature from Samba Distribution Verification Key...</span>&#8221;
114 then all is well. The warnings about trust relationships can be ignored. An
115 example of what you would not want to see would be:
116 </p><pre class="screen">
117      gpg: BAD signature from &#8220;<span class="quote">Samba Distribution Verification Key</span>&#8221;
118 </pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2973553"></a>Building the Binaries</h2></div></div><div></div></div><p>
119 <a class="indexterm" name="id2973564"></a>
120                 To build the binaries, first run the program <b class="userinput"><tt>./configure
121         </tt></b> in the source directory. This should automatically 
122         configure Samba for your operating system. If you have unusual 
123         needs, then you may wish to run</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>./configure --help
124 </tt></b></pre><p>first to see what special options you can enable. Now execute <b class="userinput"><tt>./configure</tt></b> with any arguments it might need:</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>./configure <i class="replaceable"><tt>[... arguments ...]</tt></i></tt></b></pre><p>Executing</p><p>
125 <a class="indexterm" name="id2973641"></a>
126                 </p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make</tt></b></pre><p>will create the binaries. Once it is successfully 
127         compiled you can use</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make install</tt></b></pre><p>to install the binaries and manual pages. You can 
128         separately install the binaries and/or man pages using</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make installbin
129 </tt></b></pre><p>and</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make installman
130         </tt></b></pre><p>Note that if you are upgrading from a previous version 
131         of Samba you might like to know that the old versions of 
132         the binaries will be renamed with an &#8220;<span class="quote">.old</span>&#8221; extension. You 
133         can go back to the previous version with</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make revert
134 </tt></b></pre><p>if you find this version a disaster!</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2973768"></a>Compiling Samba with Active Directory Support</h3></div></div><div></div></div><p>In order to compile Samba with ADS support, you need to have installed
135         on your system:</p><div class="itemizedlist"><ul type="disc"><li><p>The MIT or Heimdal kerberos development libraries
136             (either install from the sources or use a package).</p></li><li><p>The OpenLDAP development libraries.</p></li></ul></div><p>If your kerberos libraries are in a non-standard location, then
137                 remember to add the configure option 
138                 <tt class="option">--with-krb5=<i class="replaceable"><tt>DIR</tt></i></tt>.</p><p>After you run configure, make sure that 
139                 <tt class="filename">include/config.h</tt> it generates contain lines like 
140                 this:</p><pre class="programlisting">
141 #define HAVE_KRB5 1
142 #define HAVE_LDAP 1
143 </pre><p>If it does not, configure did not find your KRB5 libraries or
144         your LDAP libraries. Look in <tt class="filename">config.log</tt> to figure
145         out why and fix it.</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2973849"></a>Installing the Required Packages for Debian</h4></div></div><div></div></div><p>On Debian, you need to install the following packages:</p><p>
146                 </p><div class="itemizedlist"><ul type="disc"><li>libkrb5-dev</li><li>krb5-user</li></ul></div><p>
147         </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2973878"></a>Installing the Required Packages for Red Hat Linux</h4></div></div><div></div></div><p>On Red Hat Linux, this means you should have at least: </p><p>
148                 </p><div class="itemizedlist"><ul type="disc"><li>krb5-workstation (for kinit)</li><li>krb5-libs (for linking with)</li><li>krb5-devel (because you are compiling from source)</li></ul></div><p>
149         </p><p>in addition to the standard development environment.</p><p>If these files are not installed on your system, you should check the installation
150         CDs to find which has them and install the files using your tool of choice. If in doubt
151         about what tool to use, refer to the Red Hat Linux documentation.</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2973928"></a>SuSE Linux Package Requirements</h4></div></div><div></div></div><p>SuSE Linux installs Heimdal packages that may be required to allow you to build
152         binary packages. You should verify that the development libraries have been installed on
153         your system.
154         </p><p>SuSE Linux Samba RPMs support Kerberos. Please refer to the documentation for
155         your SuSE Linux system for information regading SuSE Linux specific configuration.
156         Additionally, SuSE are very active in the maintenance of Samba packages that provide
157         the maximum capabilities that are available. You should consider using SuSE provided
158         packages where they are available.
159         </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2973958"></a>Starting the <span class="application">smbd</span> and <span class="application">nmbd</span></h2></div></div><div></div></div><p>
160         <a class="indexterm" name="id2973982"></a>
161                 You must choose to start <span class="application">smbd</span> and <span class="application">nmbd</span> either
162         as daemons or from <span class="application">inetd</span>. Don't try
163         to do both!  Either you can put them in <tt class="filename">
164         inetd.conf</tt> and have them started on demand
165         by <span class="application">inetd</span> or <span class="application">xinetd</span>, 
166         or you can start them as
167         daemons either from the command line or in <tt class="filename">
168         /etc/rc.local</tt>. See the man pages for details
169         on the command line options. Take particular care to read
170         the bit about what user you need to have to start
171         Samba. In many cases, you must be root.</p><p>The main advantage of starting <span class="application">smbd</span>
172         and <span class="application">nmbd</span> using the recommended daemon method
173         is that they will respond slightly more quickly to an initial connection
174         request.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2974066"></a>Starting from inetd.conf</h3></div></div><div></div></div><a class="indexterm" name="id2974074"></a><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The following will be different if 
175                 you use NIS, NIS+ or LDAP to distribute services maps.</p></div><p>Look at your <tt class="filename">/etc/services</tt>. 
176                 What is defined at port 139/tcp? If nothing is defined, 
177                 then add a line like this:</p><pre class="programlisting">netbios-ssn     139/tcp</pre><p>Similarly for 137/udp, you should have an entry like:</p><pre class="programlisting">netbios-ns       137/udp</pre><p>Next, edit your <tt class="filename">/etc/inetd.conf</tt> 
178                 and add two lines like this:</p><pre class="programlisting">
179                 netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd 
180                 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd 
181                 </pre><p>The exact syntax of <tt class="filename">/etc/inetd.conf</tt> 
182                 varies between UNIXes. Look at the other entries in inetd.conf 
183                 for a guide. </p><p>
184                 <a class="indexterm" name="id2974166"></a>
185                 Some distributions use xinetd instead of inetd. Consult the 
186                 xinetd manual for configuration information.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some UNIXes already have entries like netbios_ns 
187                 (note the underscore) in <tt class="filename">/etc/services</tt>. 
188                 You must edit <tt class="filename">/etc/services</tt> or
189                 <tt class="filename">/etc/inetd.conf</tt> to make them consistent.
190                 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
191                 <a class="indexterm" name="id2974210"></a>
192                                 On many systems you may need to use the 
193                 <a class="indexterm" name="id2974219"></a><i class="parameter"><tt>interfaces</tt></i> option in <tt class="filename">smb.conf</tt> to specify the IP
194                 address and netmask of your interfaces. Run 
195                 <span class="application">ifconfig</span> 
196                 as root if you do not know what the broadcast is for your
197                 net. <span class="application">nmbd</span> tries to determine it at run 
198                 time, but fails on some UNIXes. 
199                 </p></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>Many UNIXes only accept around five 
200                 parameters on the command line in <tt class="filename">inetd.conf</tt>. 
201                 This means you shouldn't use spaces between the options and 
202                 arguments, or you should use a script and start the script 
203                 from <b class="command">inetd</b>.</p></div><p>Restart <span class="application">inetd</span>, perhaps just send 
204                         it a HUP. </p><pre class="screen">
205                         <tt class="prompt">root# </tt><b class="userinput"><tt>killall -HUP inetd</tt></b>
206                 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2974312"></a>Alternative: Starting <span class="application">smbd</span> as a Daemon</h3></div></div><div></div></div><p>
207                 <a class="indexterm" name="id2974330"></a>
208                         To start the server as a daemon, you should create 
209                 a script something like this one, perhaps calling 
210                 it <tt class="filename">startsmb</tt>.</p><pre class="programlisting">
211                 #!/bin/sh
212                 /usr/local/samba/bin/smbd -D 
213                 /usr/local/samba/bin/nmbd -D 
214                 </pre><p>Make it executable with <b class="command">chmod 
215                 +x startsmb</b></p><p>You can then run <b class="command">startsmb</b> by 
216                 hand or execute it from <tt class="filename">/etc/rc.local</tt>.
217                 </p><p>To kill it, send a kill signal to the processes 
218                         <span class="application">nmbd</span> and <span class="application">smbd</span>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If you use the SVR4 style init system, 
219                 you may like to look at the <tt class="filename">examples/svr4-startup</tt>
220                 script to make Samba fit into that system.</p></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="Appendixes.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="Appendixes.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="Portability.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part VI. Appendixes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 37. Portability</td></tr></table></div></body></html>