1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter�38.�How to Compile Samba</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="Appendix.html" title="Part�VI.�Appendixes"><link rel="prev" href="Appendix.html" title="Part�VI.�Appendixes"><link rel="next" href="Portability.html" title="Chapter�39.�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�38.�How to Compile Samba</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="Appendix.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�38.�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"><<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>></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"><<a href="mailto:jht@samba.org">jht@samba.org</a>></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"><<a href="mailto:tridge@samba.org">tridge@samba.org</a>></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 class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="compiling.html#id2618082">Access Samba Source Code via Subversion</a></span></dt><dd><dl><dt><span class="sect2"><a href="compiling.html#id2618089">Introduction</a></span></dt><dt><span class="sect2"><a href="compiling.html#id2618130">Subversion Access to samba.org</a></span></dt></dl></dd><dt><span class="sect1"><a href="compiling.html#id2618305">Accessing the Samba Sources via rsync and ftp</a></span></dt><dt><span class="sect1"><a href="compiling.html#id2618370">Verifying Samba's PGP Signature</a></span></dt><dt><span class="sect1"><a href="compiling.html#id2618508">Building the Binaries</a></span></dt><dd><dl><dt><span class="sect2"><a href="compiling.html#id2618734">Compiling Samba with Active Directory Support</a></span></dt></dl></dd><dt><span class="sect1"><a href="compiling.html#id2618897">Starting the <span class="application">smbd</span> and <span class="application">nmbd</span></a></span></dt><dd><dl><dt><span class="sect2"><a href="compiling.html#id2618989">Starting from inetd.conf</a></span></dt><dt><span class="sect2"><a href="compiling.html#id2619194">Alternative: Starting <span class="application">smbd</span> as a Daemon</a></span></dt></dl></dd></dl></div><p> 2You can obtain the Samba source from the 3<a href="http://samba.org/" target="_top">Samba Website.</a> To obtain a development version, 4you can download Samba from Subversion or using <span><b class="command">rsync</b></span>. 5</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2618082"></a>Access Samba Source Code via Subversion</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618089"></a>Introduction</h3></div></div></div><p> 6<a class="indexterm" name="id2618096"></a> 7Samba is developed in an open environment. Developers use a 8Subversion to “<span class="quote"><span class="emphasis"><em>checkin</em></span></span>” (also known as 9“<span class="quote"><span class="emphasis"><em>commit</em></span></span>”) new source code. Samba's various Subversion branches can 10be accessed via anonymous Subversion using the instructions 11detailed in this chapter. 12</p><p> 13This chapter is a modified version of the instructions found at the 14<a href="http://samba.org/samba/subversion.html" target="_top">Samba</a> web site. 15</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618130"></a>Subversion Access to samba.org</h3></div></div></div><p> 16The machine samba.org runs a publicly accessible Subversion 17repository for access to the source code of several packages, 18including Samba, rsync, distcc, ccache, and jitterbug. There are two main ways 19of accessing the Subversion server on this host: 20</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2618143"></a>Access via SVNweb</h4></div></div></div><p> 21<a class="indexterm" name="id2618151"></a> 22You can access the source code via your favorite WWW browser. This allows you to access 23the contents of individual files in the repository and also to look at the revision 24history and commit logs of individual files. You can also ask for a diff 25listing between any two versions on the repository. 26</p><p> 27Use the URL: 28<a href="http://svnweb.samba.org/" target="_top">http://svnweb.samba.org/</a> 29</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2618178"></a>Access via Subversion</h4></div></div></div><p> 30You can also access the source code via a 31normal Subversion client. This gives you much more control over what you can 32do with the repository and allows you to checkout whole source trees 33and keep them up-to-date via normal Subversion commands. This is the 34preferred method of access if you are a developer and not 35just a casual browser. 36</p><p>In order to be able to download the Samba sources off Subversion, you need 37a Subversion client. Your distribution might include one, or you can download the 38sources from <a href="http://subversion.tigris.org/" target="_top">http://subversion.tigris.org/</a>. 39</p><p> 40To gain access via anonymous Subversion, use the following steps. 41</p><div class="procedure"><a name="id2618210"></a><p class="title"><b>Procedure�38.1.�Retrieving Samba using Subversion</b></p><ol type="1"><li><p> 42 Install a recent copy of Subversion. All you really need is a 43 copy of the Subversion client binary. 44 </p></li><li><p> 45 Run the command 46 </p><p> 47 <b class="userinput"><tt>svn co svn://svnanon.samba.org/samba/trunk samba</tt></b>. 48 </p><p> 49 This will create a directory called <tt class="filename">samba</tt> containing the 50 latest Samba source code (usually the branch that is going to be the next major release). This 51 currently corresponds to the 3.1 development tree. 52 </p><p> 53 Subversion branches other then trunk can be obtained by adding branches/BRANCH_NAME 54 to the URL you check out. A list of branch names 55 can be found on the “<span class="quote"><span class="emphasis"><em>Development</em></span></span>” page of the Samba Web site. A common 56 request is to obtain the latest 3.0 release code. This could be done by 57 using the following command: 58 </p><p> 59 <b class="userinput"><tt>svn co svn://svnanon.samba.org/samba/branches/SAMBA_3_0 samba_3</tt></b>. 60 </p></li><li><p> 61 Whenever you want to merge in the latest code changes, use 62 the following command from within the Samba directory: 63 </p><p> 64 <b class="userinput"><tt>svn update</tt></b> 65 </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="id2618305"></a>Accessing the Samba Sources via rsync and ftp</h2></div></div></div><p> 66 <a class="indexterm" name="id2618313"></a> 67 <a class="indexterm" name="id2618320"></a> 68 <i class="parameter"><tt>pserver.samba.org</tt></i> also exports unpacked copies of most parts of the Subversion 69 tree at the Samba <a href="ftp://pserver.samba.org/pub/unpacked" target="_top">pserver</a> 70 location and also via anonymous rsync at the Samba 71 <a href="rsync://pserver.samba.org/ftp/unpacked/" target="_top">rsync</a> server location. 72 I recommend using rsync rather than ftp. 73 See <a href="http://rsync.samba.org/" target="_top">the rsync home-page</a> for more info on rsync. 74 </p><p> 75 The disadvantage of the unpacked trees is that they do not support automatic 76 merging of local changes like Subversion does. <span><b class="command">rsync</b></span> access is most convenient 77 for an initial install. 78 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2618370"></a>Verifying Samba's PGP Signature</h2></div></div></div><p> 79<a class="indexterm" name="id2618379"></a> 80It is strongly recommended that you verify the PGP signature for any source file before 81installing it. Even if you're not downloading from a mirror site, verifying PGP signatures 82should be a standard reflex. Many people today use the GNU GPG tool-set in place of PGP. 83GPG can substitute for PGP. 84</p><p> 85With that said, go ahead and download the following files: 86</p><pre class="screen"> 87<tt class="prompt">$ </tt><b class="userinput"><tt>wget http://us1.samba.org/samba/ftp/samba-3.0.0.tar.asc</tt></b> 88<tt class="prompt">$ </tt><b class="userinput"><tt>wget http://us1.samba.org/samba/ftp/samba-pubkey.asc</tt></b> 89</pre><p> 90<a class="indexterm" name="id2618426"></a> 91The first file is the PGP signature for the Samba source file; the other is the Samba public 92PGP key itself. Import the public PGP key with: 93</p><pre class="screen"> 94<tt class="prompt">$ </tt><b class="userinput"><tt>gpg --import samba-pubkey.asc</tt></b> 95</pre><p> 96and verify the Samba source code integrity with: 97</p><pre class="screen"> 98<tt class="prompt">$ </tt><b class="userinput"><tt>gzip -d samba-3.0.0.tar.gz</tt></b> 99<tt class="prompt">$ </tt><b class="userinput"><tt>gpg --verify samba-3.0.0.tar.asc</tt></b> 100</pre><p> 101If you receive a message like, “<span class="quote"><span class="emphasis"><em>Good signature from Samba Distribution Verification Key...</em></span></span>” 102then all is well. The warnings about trust relationships can be ignored. An 103example of what you would not want to see would be: 104</p><pre class="screen"> 105 gpg: BAD signature from “<span class="quote"><span class="emphasis"><em>Samba Distribution Verification Key</em></span></span>” 106</pre></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2618508"></a>Building the Binaries</h2></div></div></div><p> 107 <a class="indexterm" name="id2618516"></a> 108 After the source tarball has been unpacked, the next step involves 109 configuration to match Samba to your operating system platform. 110 If your source directory does not contain the <span><b class="command">configure</b></span> script 111 it is necessary to build it before you can continue. Building of 112 the configure script requires the correct version of the autoconf 113 tool kit. Where the necessary version of autoconf is present, 114 the configure script can be generated by executing the following: 115</p><pre class="screen"> 116<tt class="prompt">root# </tt> cd samba-3.0.0 117<tt class="prompt">root# </tt> ./autogen.sh 118</pre><p> 119 </p><p> 120 <a class="indexterm" name="id2618558"></a> 121 To build the binaries, run the program <b class="userinput"><tt>./configure 122 </tt></b> in the source directory. This should automatically 123 configure Samba for your operating system. If you have unusual 124 needs, then you may wish to run</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>./configure --help 125</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> 126<a class="indexterm" name="id2618625"></a> 127 </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 128 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 129 separately install the binaries and/or man pages using</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make installbin 130</tt></b></pre><p>and</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make installman 131 </tt></b></pre><p>Note that if you are upgrading from a previous version 132 of Samba you might like to know that the old versions of 133 the binaries will be renamed with an “<span class="quote"><span class="emphasis"><em>.old</em></span></span>” extension. You 134 can go back to the previous version with</p><pre class="screen"><tt class="prompt">root# </tt><b class="userinput"><tt>make revert 135</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="id2618734"></a>Compiling Samba with Active Directory Support</h3></div></div></div><p>In order to compile Samba with ADS support, you need to have installed 136 on your system:</p><div class="itemizedlist"><ul type="disc"><li><p>The MIT or Heimdal Kerberos development libraries 137 (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 138 remember to add the configure option 139 <tt class="option">--with-krb5=<i class="replaceable"><tt>DIR</tt></i></tt>.</p><p>After you run configure, make sure that 140 <tt class="filename">include/config.h</tt> it generates contain lines like 141 this:</p><pre class="programlisting"> 142#define HAVE_KRB5 1 143#define HAVE_LDAP 1 144</pre><p>If it does not, configure did not find your KRB5 libraries or 145 your LDAP libraries. Look in <tt class="filename">config.log</tt> to figure 146 out why and fix it.</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2618800"></a>Installing the Required Packages for Debian</h4></div></div></div><p>On Debian, you need to install the following packages:</p><p> 147 </p><div class="itemizedlist"><ul type="disc"><li><p>libkrb5-dev</p></li><li><p>krb5-user</p></li></ul></div><p> 148 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2618827"></a>Installing the Required Packages for Red Hat Linux</h4></div></div></div><p>On Red Hat Linux, this means you should have at least: </p><p> 149 </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> 150 </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 151 CDs to find which has them and install the files using your tool of choice. If in doubt 152 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="id2618871"></a>SuSE Linux Package Requirements</h4></div></div></div><p>SuSE Linux installs Heimdal packages that may be required to allow you to build 153 binary packages. You should verify that the development libraries have been installed on 154 your system. 155 </p><p>SuSE Linux Samba RPMs support Kerberos. Please refer to the documentation for 156 your SuSE Linux system for information regarding SuSE Linux specific configuration. 157 Additionally, SuSE are very active in the maintenance of Samba packages that provide 158 the maximum capabilities that are available. You should consider using SuSE provided 159 packages where they are available. 160 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2618897"></a>Starting the <span class="application">smbd</span> and <span class="application">nmbd</span></h2></div></div></div><p> 161 <a class="indexterm" name="id2618915"></a> 162 You must choose to start <span class="application">smbd</span> and <span class="application">nmbd</span> either 163 as daemons or from <span class="application">inetd</span>. Don't try 164 to do both! Either you can put them in <tt class="filename"> 165 inetd.conf</tt> and have them started on demand 166 by <span class="application">inetd</span> or <span class="application">xinetd</span>, 167 or you can start them as 168 daemons either from the command line or in <tt class="filename"> 169 /etc/rc.local</tt>. See the man pages for details 170 on the command line options. Take particular care to read 171 the bit about what user you need to have to start 172 Samba. In many cases, you must be root.</p><p>The main advantage of starting <span class="application">smbd</span> 173 and <span class="application">nmbd</span> using the recommended daemon method 174 is that they will respond slightly more quickly to an initial connection 175 request.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2618989"></a>Starting from inetd.conf</h3></div></div></div><a class="indexterm" name="id2618995"></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 176 you use NIS, NIS+ or LDAP to distribute services maps.</p></div><p>Look at your <tt class="filename">/etc/services</tt>. 177 What is defined at port 139/tcp? If nothing is defined, 178 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> 179 and add two lines like this:</p><pre class="programlisting"> 180 netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd 181 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd 182 </pre><p>The exact syntax of <tt class="filename">/etc/inetd.conf</tt> 183 varies between UNIXes. Look at the other entries in inetd.conf 184 for a guide. </p><p> 185 <a class="indexterm" name="id2619072"></a> 186 Some distributions use xinetd instead of inetd. Consult the 187 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 188 (note the underscore) in <tt class="filename">/etc/services</tt>. 189 You must edit <tt class="filename">/etc/services</tt> or 190 <tt class="filename">/etc/inetd.conf</tt> to make them consistent. 191 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 192 <a class="indexterm" name="id2619110"></a> 193 On many systems you may need to use the 194 <a class="indexterm" name="id2619118"></a>interfaces option in <tt class="filename">smb.conf</tt> to specify the IP 195 address and netmask of your interfaces. Run 196 <span class="application">ifconfig</span> 197 as root if you do not know what the broadcast is for your 198 net. <span class="application">nmbd</span> tries to determine it at run 199 time, but fails on some UNIXes. 200 </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 201 parameters on the command line in <tt class="filename">inetd.conf</tt>. 202 This means you shouldn't use spaces between the options and 203 arguments, or you should use a script and start the script 204 from <span><b class="command">inetd</b></span>.</p></div><p>Restart <span class="application">inetd</span>, perhaps just send 205 it a HUP. </p><pre class="screen"> 206 <tt class="prompt">root# </tt><b class="userinput"><tt>killall -HUP inetd</tt></b> 207 </pre></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2619194"></a>Alternative: Starting <span class="application">smbd</span> as a Daemon</h3></div></div></div><p> 208 <a class="indexterm" name="id2619208"></a> 209 To start the server as a daemon, you should create 210 a script something like this one, perhaps calling 211 it <tt class="filename">startsmb</tt>.</p><pre class="programlisting"> 212 #!/bin/sh 213 /usr/local/samba/bin/smbd -D 214 /usr/local/samba/bin/nmbd -D 215 </pre><p>Make it executable with <span><b class="command">chmod 216 +x startsmb</b></span></p><p>You can then run <span><b class="command">startsmb</b></span> by 217 hand or execute it from <tt class="filename">/etc/rc.local</tt>. 218 </p><p>To kill it, send a kill signal to the processes 219 <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, 220 you may like to look at the <tt class="filename">examples/svr4-startup</tt> 221 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="Appendix.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="Appendix.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�39.�Portability</td></tr></table></div></body></html> 222