preparing for release of 3.0alpha24
[Samba/gbeck.git] / docs / htmldocs / compiling.html
blobc62fcf13f2a33da8e0a9cb344ed6fed4fe6f956e
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 30. How to compile SAMBA</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"><link rel="home" href="index.html" title="SAMBA Project Documentation"><link rel="up" href="Appendixes.html" title="Part V. Appendixes"><link rel="previous" href="Appendixes.html" title="Part V. Appendixes"><link rel="next" href="NT4Migration.html" title="Chapter 31. Migration from NT4 PDC to Samba-3 PDC"></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 30. 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 V. Appendixes</th><td width="20%" align="right"> <a accesskey="n" href="NT4Migration.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="compiling"></a>Chapter 30. How to compile SAMBA</h2></div><div><div class="author"><h3 class="author"></h3><div class="affiliation"><span class="orgname">Samba Team<br></span></div></div></div><div><div class="author"><h3 class="author">Jelmer R. Vernooij</h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><tt>&lt;<a href="mailto:jelmer@samba.org">jelmer@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 class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="compiling.html#id2904479">Access Samba source code via CVS</a></dt><dd><dl><dt><a href="compiling.html#id2904486">Introduction</a></dt><dt><a href="compiling.html#id2904519">CVS Access to samba.org</a></dt></dl></dd><dt><a href="compiling.html#id2905273">Accessing the samba sources via rsync and ftp</a></dt><dt><a href="compiling.html#id2905314">Verifying Samba's PGP signature</a></dt><dt><a href="compiling.html#id2905397">Building the Binaries</a></dt><dd><dl><dt><a href="compiling.html#id2905534">Compiling samba with Active Directory support</a></dt></dl></dd><dt><a href="compiling.html#id2905682">Starting the smbd and nmbd</a></dt><dd><dl><dt><a href="compiling.html#id2905749">Starting from inetd.conf</a></dt><dt><a href="compiling.html#id2905941">Alternative: starting it as a daemon</a></dt></dl></dd></dl></div><p>
3 You can obtain the samba source from the <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><h2 class="title" style="clear: both"><a name="id2904479"></a>Access Samba source code via CVS</h2></div></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2904486"></a>Introduction</h3></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><h3 class="title"><a name="id2904519"></a>CVS Access to samba.org</h3></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 and jitterbug. There are two main ways of
18 accessing the CVS server on this host.
19 </p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2904535"></a>Access via CVSweb</h4></div></div><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><h4 class="title"><a name="id2905096"></a>Access via cvs</h4></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 : <a href="http://www.cyclic.com/" target="_top">http://www.cyclic.com/</a>.
37 and click on the 'How to get cvs' link. CVS is free software under
38 the GNU GPL (as is Samba). Note that there are several graphical CVS clients
39 which provide a graphical interface to the sometimes mundane CVS commands.
40 Links to theses clients are also available from http://www.cyclic.com.
41 </p><p>
42 To gain access via anonymous cvs use the following steps.
43 For this example it is assumed that you want a copy of the
44 samba source code. For the other source code repositories
45 on this system just substitute the correct package name
46 </p><div class="orderedlist"><ol type="1"><li><p>
47 Install a recent copy of cvs. All you really need is a
48 copy of the cvs client binary.
49 </p></li><li><p>
50 Run the command
51 </p><p>
52 <b><tt>cvs -d :pserver:cvs@samba.org:/cvsroot login</tt></b>
53 </p><p>
54 When it asks you for a password type <b><tt>cvs</tt></b>.
55 </p></li><li><p>
56 Run the command
57 </p><p>
58 <b><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co samba</tt></b>
59 </p><p>
60 This will create a directory called samba containing the
61 latest samba source code (i.e. the HEAD tagged cvs branch). This
62 currently corresponds to the 3.0 development tree.
63 </p><p>
64 CVS branches other then HEAD can be obtained by using the <i><tt>-r</tt></i>
65 and defining a tag name. A list of branch tag names can be found on the
66 &quot;Development&quot; page of the samba web site. A common request is to obtain the
67 latest 2.2 release code. This could be done by using the following userinput.
68 </p><p>
69 <b><tt>cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_2_2 samba</tt></b>
70 </p></li><li><p>
71 Whenever you want to merge in the latest code changes use
72 the following command from within the samba directory:
73 </p><p>
74 <b><tt>cvs update -d -P</tt></b>
75 </p></li></ol></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2905273"></a>Accessing the samba sources via rsync and ftp</h2></div></div><p>
76 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.
77 See <a href="http://rsync.samba.org/" target="_top">the rsync homepage</a> for more info on rsync.
78 </p><p>
79 The disadvantage of the unpacked trees
80 is that they do not support automatic
81 merging of local changes like CVS does.
82 rsync access is most convenient for an
83 initial install.
84 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2905314"></a>Verifying Samba's PGP signature</h2></div></div><p>
85 In these days of insecurity, it's strongly recommended that you verify the PGP signature for any
86 source file before installing it. According to Jerry Carter of the Samba Team, only about 22% of
87 all Samba downloads have had a corresponding PGP signature download (a very low percentage, which
88 should be considered a bad thing). Even if you're not downloading from a mirror site, verifying PGP
89 signatures should be a standard reflex.
90 </p><p>
91 With that said, go ahead and download the following files:
92 </p><pre class="programlisting">
93 $ wget http://us1.samba.org/samba/ftp/samba-2.2.8a.tar.asc
94 $ wget http://us1.samba.org/samba/ftp/samba-pubkey.asc
95 </pre><p>
96 The first file is the PGP signature for the Samba source file; the other is the Samba public
97 PGP key itself. Import the public PGP key with:
98 </p><pre class="programlisting">
99 $ gpg --import samba-pubkey.asc
100 </pre><p>
101 And verify the Samba source code integrity with:
102 </p><pre class="programlisting">
103 $ gzip -d samba-2.2.8a.tar.gz
104 $ gpg --verify samba-2.2.8a.tar.asc
105 </pre><p>
106 If you receive a message like, &quot;Good signature from Samba Distribution Verification Key...&quot;
107 then all is well. The warnings about trust relationships can be ignored. An example of what
108 you would not want to see would be:
109 </p><pre class="programlisting">
110 gpg: BAD signature from &quot;Samba Distribution Verification Key&quot;
111 </pre></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2905397"></a>Building the Binaries</h2></div></div><p>To do this, first run the program <b><tt>./configure
112 </tt></b> in the source directory. This should automatically
113 configure Samba for your operating system. If you have unusual
114 needs then you may wish to run</p><p><tt>root# </tt><b><tt>./configure --help
115 </tt></b></p><p>first to see what special options you can enable.
116 Then executing</p><p><tt>root# </tt><b><tt>make</tt></b></p><p>will create the binaries. Once it's successfully
117 compiled you can use </p><p><tt>root# </tt><b><tt>make install</tt></b></p><p>to install the binaries and manual pages. You can
118 separately install the binaries and/or man pages using</p><p><tt>root# </tt><b><tt>make installbin
119 </tt></b></p><p>and</p><p><tt>root# </tt><b><tt>make installman
120 </tt></b></p><p>Note that if you are upgrading for a previous version
121 of Samba you might like to know that the old versions of
122 the binaries will be renamed with a &quot;.old&quot; extension. You
123 can go back to the previous version with</p><p><tt>root# </tt><b><tt>make revert
124 </tt></b></p><p>if you find this version a disaster!</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2905534"></a>Compiling samba with Active Directory support</h3></div></div><p>In order to compile samba with ADS support, you need to have installed
125 on your system:</p><div class="itemizedlist"><ul type="disc"><li><p>the MIT kerberos development libraries
126 (either install from the sources or use a package). The
127 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
128 remember to add the configure option --with-krb5=DIR.</p><p>After you run configure make sure that <tt>include/config.h</tt> it generates contains lines like this:</p><pre class="programlisting">
129 #define HAVE_KRB5 1
130 #define HAVE_LDAP 1
131 </pre><p>If it doesn't then configure did not find your krb5 libraries or
132 your ldap libraries. Look in config.log to figure out why and fix
133 it.</p><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2905601"></a>Installing the required packages for Debian</h4></div></div><p>On Debian you need to install the following packages:</p><p>
134 </p><div class="itemizedlist"><ul type="disc"><li>libkrb5-dev</li><li>krb5-user</li></ul></div><p>
135 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><h4 class="title"><a name="id2905632"></a>Installing the required packages for RedHat</h4></div></div><p>On RedHat this means you should have at least: </p><p>
136 </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>
137 </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
138 to get them off CD2.</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2905682"></a>Starting the smbd and nmbd</h2></div></div><p>You must choose to start smbd and nmbd either
139 as daemons or from inetdDon't try
140 to do both! Either you can put them in <tt>
141 inetd.conf</tt> and have them started on demand
142 by inetd, or you can start them as
143 daemons either from the command line or in <tt>
144 /etc/rc.local</tt>. See the man pages for details
145 on the command line options. Take particular care to read
146 the bit about what user you need to be in order to start
147 Samba. In many cases you must be root.</p><p>The main advantage of starting smbd
148 and nmbd using the recommended daemon method
149 is that they will respond slightly more quickly to an initial connection
150 request.</p><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2905749"></a>Starting from inetd.conf</h3></div></div><p>NOTE; The following will be different if
151 you use NIS, NIS+ or LDAP to distribute services maps.</p><p>Look at your <tt>/etc/services</tt>.
152 What is defined at port 139/tcp. If nothing is defined
153 then add a line like this:</p><p><b><tt>netbios-ssn 139/tcp</tt></b></p><p>similarly for 137/udp you should have an entry like:</p><p><b><tt>netbios-ns 137/udp</tt></b></p><p>Next edit your <tt>/etc/inetd.conf</tt>
154 and add two lines something like this:</p><pre class="programlisting">
155 netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd
156 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd
157 </pre><p>The exact syntax of <tt>/etc/inetd.conf</tt>
158 varies between unixes. Look at the other entries in inetd.conf
159 for a guide.</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
160 (note the underscore) in <tt>/etc/services</tt>.
161 You must either edit <tt>/etc/services</tt> or
162 <tt>/etc/inetd.conf</tt> to make them consistent.</p></div><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
163 <b>interfaces</b> option in <tt>smb.conf</tt> to specify the IP address
164 and netmask of your interfaces. Run ifconfig
165 as root if you don't know what the broadcast is for your
166 net. nmbd tries to determine it at run
167 time, but fails on some unixes.
168 </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
169 parameters on the command line in <tt>inetd.conf</tt>.
170 This means you shouldn't use spaces between the options and
171 arguments, or you should use a script, and start the script
172 from <b>inetd</b>.</p></div><p>Restart <b>inetd</b>, perhaps just send
173 it a HUP. If you have installed an earlier version of
174 nmbd then you may need to kill nmbd as well.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2905941"></a>Alternative: starting it as a daemon</h3></div></div><p>To start the server as a daemon you should create
175 a script something like this one, perhaps calling
176 it <tt>startsmb</tt>.</p><pre class="programlisting">
177 #!/bin/sh
178 /usr/local/samba/bin/smbd -D
179 /usr/local/samba/bin/nmbd -D
180 </pre><p>then make it executable with <b>chmod
181 +x startsmb</b></p><p>You can then run <b>startsmb</b> by
182 hand or execute it from <tt>/etc/rc.local</tt>
183 </p><p>To kill it send a kill signal to the processes
184 <b>nmbd</b> and <b>smbd</b>.</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
185 you may like to look at the <tt>examples/svr4-startup</tt>
186 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="NT4Migration.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part V. Appendixes </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 31. Migration from NT4 PDC to Samba-3 PDC</td></tr></table></div></body></html>