syncing files from 3.0 into HEAD again
[Samba/bb.git] / docs / htmldocs / compiling.html
blob95cdb0f581c73241bd591b1a89f51cd30a9dad2c
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="samba-doc.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">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#id2961265">Access Samba source code via CVS</a></dt><dd><dl><dt><a href="compiling.html#id2961282">Introduction</a></dt><dt><a href="compiling.html#id2961320">CVS Access to samba.org</a></dt></dl></dd><dt><a href="compiling.html#id2961581">Accessing the samba sources via rsync and ftp</a></dt><dt><a href="compiling.html#id2961644">Verifying Samba's PGP signature</a></dt><dt><a href="compiling.html#id2961798">Building the Binaries</a></dt><dd><dl><dt><a href="compiling.html#id2961978">Compiling samba with Active Directory support</a></dt></dl></dd><dt><a href="compiling.html#id2962144">Starting the smbd and nmbd</a></dt><dd><dl><dt><a href="compiling.html#id2962252">Starting from inetd.conf</a></dt><dt><a href="compiling.html#id2962499">Alternative: starting it as a daemon</a></dt></dl></dd></dl></div><p>
2 You can obtain the samba source from the
3 <a href="http://samba.org/" target="_top">samba website</a>. To obtain a development version,
4 you can download samba from CVS or using rsync.
5 </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2961265"></a>Access Samba source code via CVS</h2></div></div><div></div></div><a class="indexterm" name="id2961274"></a><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2961282"></a>Introduction</h3></div></div><div></div></div><p>
6 Samba is developed in an open environment. Developers use CVS
7 (Concurrent Versioning System) to &quot;checkin&quot; (also known as
8 &quot;commit&quot;) new source code. Samba's various CVS branches can
9 be accessed via anonymous CVS using the instructions
10 detailed in this chapter.
11 </p><p>
12 This chapter is a modified version of the instructions found at
13 <a href="http://samba.org/samba/cvs.html" target="_top">http://samba.org/samba/cvs.html</a>
14 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2961320"></a>CVS Access to samba.org</h3></div></div><div></div></div><p>
15 The machine samba.org runs a publicly accessible CVS
16 repository for access to the source code of several packages,
17 including samba, rsync, distcc, ccache and jitterbug. There are two main ways
18 of accessing the CVS server on this host.
19 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2961335"></a>Access via CVSweb</h4></div></div><div></div></div><a class="indexterm" name="id2961344"></a><p>
20 You can access the source code via your
21 favourite WWW browser. This allows you to access the contents of
22 individual files in the repository and also to look at the revision
23 history and commit logs of individual files. You can also ask for a diff
24 listing between any two versions on the repository.
25 </p><p>
26 Use the URL : <a href="http://samba.org/cgi-bin/cvsweb" target="_top">http://samba.org/cgi-bin/cvsweb</a>
27 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2961383"></a>Access via cvs</h4></div></div><div></div></div><p>
28 You can also access the source code via a
29 normal cvs client. This gives you much more control over what you can
30 do with the repository and allows you to checkout whole source trees
31 and keep them up to date via normal cvs commands. This is the
32 preferred method of access if you are a developer and not
33 just a casual browser.
34 </p><p>
35 To download the latest cvs source code, point your
36 browser at the URL :
37 <a href="http://www.cyclic.com/" target="_top">http://www.cyclic.com/</a>.
38 and click on the 'How to get cvs' link. CVS is free software under
39 the GNU GPL (as is Samba). Note that there are several graphical CVS clients
40 which provide a graphical interface to the sometimes mundane CVS commands.
41 Links to theses clients are also available from the Cyclic website.
42 </p><p>
43 To gain access via anonymous cvs use the following steps.
44 For this example it is assumed that you want a copy of the
45 samba source code. For the other source code repositories
46 on this system just substitute the correct package name
47 </p><div class="procedure"><p class="title"><b>Procedure 36.1. Retrieving samba using CVS</b></p><ol type="1"><li><p>
48 Install a recent copy of cvs. All you really need is a
49 copy of the cvs client binary.
50 </p></li><li><p>
51 Run the command
52 </p><p>
53 <b class="userinput"><tt>cvs -d :pserver:cvs@samba.org:/cvsroot login</tt></b>
54 </p></li><li><p>
55 When it asks you for a password type <b class="userinput"><tt>cvs</tt></b>.
56 </p></li><li><p>
57 Run the command
58 </p><p>
59 <b class="userinput"><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co samba</tt></b>
60 </p><p>
61 This will create a directory called samba containing the
62 latest samba source code (i.e. the HEAD tagged cvs branch). This
63 currently corresponds to the 3.0 development tree.
64 </p><p>
65 CVS branches other then HEAD can be obtained by using the
66 <tt class="option">-r</tt> and defining a tag name. A list of branch tag names
67 can be found on the &quot;Development&quot; page of the samba web site. A common
68 request is to obtain the latest 3.0 release code. This could be done by
69 using the following command:
70 </p><p>
71 <b class="userinput"><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_3_0 samba</tt></b>
72 </p></li><li><p>
73 Whenever you want to merge in the latest code changes use
74 the following command from within the samba directory:
75 </p><p>
76 <b class="userinput"><tt>cvs update -d -P</tt></b>
77 </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="id2961581"></a>Accessing the samba sources via rsync and ftp</h2></div></div><div></div></div><a class="indexterm" name="id2961589"></a><a class="indexterm" name="id2961597"></a><p>
78 pserver.samba.org also exports unpacked copies of most parts of the CVS
79 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
80 <a href="rsync://pserver.samba.org/ftp/unpacked/" target="_top">rsync://pserver.samba.org/ftp/unpacked/</a>. I recommend using rsync rather than ftp.
81 See <a href="http://rsync.samba.org/" target="_top">the rsync homepage</a> for more info on rsync.
82 </p><p>
83 The disadvantage of the unpacked trees is that they do not support automatic
84 merging of local changes like CVS does. rsync access is most convenient
85 for an initial install.
86 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2961644"></a>Verifying Samba's PGP signature</h2></div></div><div></div></div><p>
87 In these days of insecurity, it's strongly recommended that you verify the PGP
88 signature for any source file before installing it. Even if you're not
89 downloading from a mirror site, verifying PGP signatures should be a
90 standard reflex.
91 </p><p>
92 With that said, go ahead and download the following files:
93 </p><pre class="screen">
94 <tt class="prompt">$ </tt><b class="userinput"><tt>wget http://us1.samba.org/samba/ftp/samba-2.2.8a.tar.asc</tt></b>
95 <tt class="prompt">$ </tt><b class="userinput"><tt>wget http://us1.samba.org/samba/ftp/samba-pubkey.asc</tt></b>
96 </pre><p>
97 <a class="indexterm" name="id2961705"></a>
98 The first file is the PGP signature for the Samba source file; the other is the Samba public
99 PGP key itself. Import the public PGP key with:
100 </p><pre class="screen">
101 <tt class="prompt">$ </tt><b class="userinput"><tt>gpg --import samba-pubkey.asc</tt></b>
102 </pre><p>
103 And verify the Samba source code integrity with:
104 </p><pre class="screen">
105 <tt class="prompt">$ </tt><b class="userinput"><tt>gzip -d samba-2.2.8a.tar.gz</tt></b>
106 <tt class="prompt">$ </tt><b class="userinput"><tt>gpg --verify samba-2.2.8a.tar.asc</tt></b>
107 </pre><p>
108 If you receive a message like, &quot;Good signature from Samba Distribution
109 Verification Key...&quot;
110 then all is well. The warnings about trust relationships can be ignored. An
111 example of what you would not want to see would be:
112 </p><p>
113 <tt class="computeroutput">
114 gpg: BAD signature from &quot;Samba Distribution Verification Key&quot;
115 </tt>
116 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2961798"></a>Building the Binaries</h2></div></div><div></div></div><a class="indexterm" name="id2961805"></a><p>
117 To do this, first run the program <b class="userinput"><tt>./configure
118 </tt></b> in the source directory. This should automatically
119 configure Samba for your operating system. If you have unusual
120 needs then you may wish to run</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>./configure --help
121 </tt></b></pre><p>first to see what special options you can enable.
122 Then executing</p><a class="indexterm" name="id2961851"></a><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make</tt></b></pre><p>will create the binaries. Once it's successfully
123 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
124 separately install the binaries and/or man pages using</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make installbin
125 </tt></b></pre><p>and</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make installman
126 </tt></b></pre><p>Note that if you are upgrading for a previous version
127 of Samba you might like to know that the old versions of
128 the binaries will be renamed with a &quot;.old&quot; extension. You
129 can go back to the previous version with</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make revert
130 </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="id2961978"></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
131 on your system:</p><div class="itemizedlist"><ul type="disc"><li><p>the MIT kerberos development libraries
132 (either install from the sources or use a package). The
133 Heimdal libraries will not work.</p></li><li><p>the OpenLDAP development libraries.</p></li></ul></div><p>If your kerberos libraries are in a non-standard location then
134 remember to add the configure option
135 <tt class="option">--with-krb5=<i class="replaceable"><tt>DIR</tt></i></tt>.</p><p>After you run configure make sure that
136 <tt class="filename">include/config.h</tt> it generates contains lines like
137 this:</p><pre class="programlisting">
138 #define HAVE_KRB5 1
139 #define HAVE_LDAP 1
140 </pre><p>If it doesn't then configure did not find your krb5 libraries or
141 your ldap libraries. Look in <tt class="filename">config.log</tt> to figure
142 out why and fix it.</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2962059"></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>
143 </p><div class="itemizedlist"><ul type="disc"><li><p>libkrb5-dev</p></li><li><p>krb5-user</p></li></ul></div><p>
144 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2962091"></a>Installing the required packages for RedHat</h4></div></div><div></div></div><p>On RedHat this means you should have at least: </p><p>
145 </p><div class="itemizedlist"><ul type="disc"><li><p>krb5-workstation (for kinit)</p></li><li><p>krb5-libs (for linking with)</p></li><li><p>krb5-devel (because you are compiling from source)</p></li></ul></div><p>
146 </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
147 to get them off CD2.</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2962144"></a>Starting the <span class="application">smbd</span> and <span class="application">nmbd</span></h2></div></div><div></div></div><a class="indexterm" name="id2962165"></a><p>You must choose to start <span class="application">smbd</span> and <span class="application">nmbd</span> either
148 as daemons or from <span class="application">inetd</span>. Don't try
149 to do both! Either you can put them in <tt class="filename">
150 inetd.conf</tt> and have them started on demand
151 by <span class="application">inetd</span> or <span class="application">xinetd</span>,
152 or you can start them as
153 daemons either from the command line or in <tt class="filename">
154 /etc/rc.local</tt>. See the man pages for details
155 on the command line options. Take particular care to read
156 the bit about what user you need to be in order to start
157 Samba. In many cases you must be root.</p><p>The main advantage of starting <span class="application">smbd</span>
158 and <span class="application">nmbd</span> using the recommended daemon method
159 is that they will respond slightly more quickly to an initial connection
160 request.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2962252"></a>Starting from inetd.conf</h3></div></div><div></div></div><a class="indexterm" name="id2962260"></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
161 you use NIS, NIS+ or LDAP to distribute services maps.</p></div><p>Look at your <tt class="filename">/etc/services</tt>.
162 What is defined at port 139/tcp. If nothing is defined
163 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>
164 and add two lines something like this:</p><pre class="programlisting">
165 netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
166 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
167 </pre><p>The exact syntax of <tt class="filename">/etc/inetd.conf</tt>
168 varies between unixes. Look at the other entries in inetd.conf
169 for a guide. </p><a class="indexterm" name="id2962350"></a><p>Some distributions use xinetd instead of inetd. Consult the
170 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
171 (note the underscore) in <tt class="filename">/etc/services</tt>.
172 You must either edit <tt class="filename">/etc/services</tt> or
173 <tt class="filename">/etc/inetd.conf</tt> to make them consistent.
174 </p></div><a class="indexterm" name="id2962393"></a><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>On many systems you may need to use the
175 <a class="indexterm" name="id2962405"></a><i class="parameter"><tt>interfaces</tt></i> option in <tt class="filename">smb.conf</tt> to specify the IP
176 address and netmask of your interfaces. Run
177 <span class="application">ifconfig</span>
178 as root if you don't know what the broadcast is for your
179 net. <span class="application">nmbd</span> tries to determine it at run
180 time, but fails on some unixes.
181 </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 5
182 parameters on the command line in <tt class="filename">inetd.conf</tt>.
183 This means you shouldn't use spaces between the options and
184 arguments, or you should use a script, and start the script
185 from <b class="command">inetd</b>.</p></div><p>Restart <span class="application">inetd</span>, perhaps just send
186 it a HUP. </p><pre class="screen">
187 <tt class="prompt">root# </tt><b class="userinput"><tt>killall -HUP inetd</tt></b>
188 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2962499"></a>Alternative: starting it as a daemon</h3></div></div><div></div></div><a class="indexterm" name="id2962507"></a><p>To start the server as a daemon you should create
189 a script something like this one, perhaps calling
190 it <tt class="filename">startsmb</tt>.</p><pre class="programlisting">
191 #!/bin/sh
192 /usr/local/samba/bin/smbd -D
193 /usr/local/samba/bin/nmbd -D
194 </pre><p>then make it executable with <b class="command">chmod
195 +x startsmb</b></p><p>You can then run <b class="command">startsmb</b> by
196 hand or execute it from <tt class="filename">/etc/rc.local</tt>
197 </p><p>To kill it send a kill signal to the processes
198 <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 then
199 you may like to look at the <tt class="filename">examples/svr4-startup</tt>
200 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="samba-doc.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 37. Portability</td></tr></table></div></body></html>