1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 2] 2.3 Compiling and Installing Samba</title><META NAME="DC.title" CONTENT=""><META NAME="DC.creator" CONTENT=""><META NAME="DC.publisher" CONTENT="O'Reilly & Associates, Inc."><META NAME="DC.date" CONTENT="1999-11-05T21:29:09Z"><META NAME="DC.type" CONTENT="Text.Monograph"><META NAME="DC.format" CONTENT="text/html" SCHEME="MIME"><META NAME="DC.source" CONTENT="" SCHEME="ISBN"><META NAME="DC.language" CONTENT="en-US"><META NAME="generator" CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"></head> 5<BODY BGCOLOR="#FFFFFF" TEXT="#000000" link="#990000" vlink="#0000CC"> 6<table BORDER="0" CELLPADDING="0" CELLSPACING="0" width="90%"> 7<tr> 8<td width="25%" valign="TOP"> 9<img hspace=10 vspace=10 src="gifs/samba.s.gif" 10alt="Using Samba" align=left valign=top border=0> 11</td> 12<td height="105" valign="TOP"> 13<br> 14<H2>Using Samba</H2> 15<font size="-1"> 16Robert Eckstein, David Collier-Brown, Peter Kelly 17<br>1st Edition November 1999 18<br>1-56592-449-5, Order Number: 4495 19<br>416 pages, $34.95 20</font> 21<p> <a href="http://www.oreilly.com/catalog/samba/">Buy the hardcopy</a> 22<p><a href="index.html">Table of Contents</a> 23</td> 24</tr> 25</table> 26<hr size=1 noshade> 27<!--sample chapter begins --> 28 29<center> 30<DIV CLASS="htmlnav"> 31<TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 32<TR> 33<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 34<A CLASS="sect1" HREF="ch02_02.html" TITLE="2.2 Configuring Samba"> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 2.2 Configuring Samba" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 36<B> 37<FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1"> 38<A CLASS="chapter" REL="up" HREF="ch02_01.html" TITLE="2. Installing Samba on a Unix System"> 39Chapter 2<br> 40Installing Samba on a Unix System</a></font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 41<A CLASS="sect1" HREF="ch02_04.html" TITLE="2.4 A Basic Samba Configuration File"> 42<IMG SRC="gifs/txtnexta.gif" ALT="Next: 2.4 A Basic Samba Configuration File" BORDER="0"></a></td></tr></table> <hr noshade size=1></center> 43</div> 44<blockquote> 45<div> 46<H2 CLASS="sect1"> 47<A CLASS="title" NAME="ch02-13217"> 482.3 Compiling and Installing Samba</a></h2><P CLASS="para">At this point you should be ready to build the Samba executables. Compiling is also easy: in the <I CLASS="filename"> 49source</i> directory, type <CODE CLASS="literal"> 50make</code> on the command line. The <I CLASS="filename"> 51make</i> utility will produce a stream of explanatory and success messages, beginning with:</p><PRE CLASS="programlisting"> 52Using FLAGS = -O -Iinclude ...</pre><P CLASS="para"> 53This build includes compiles for both <EM CLASS="emphasis"> 54smbd</em> and <EM CLASS="emphasis"> 55nmbd</em>, and ends in a linking command for <I CLASS="filename"> 56bin/make_ printerdef</i>. For example, here is a sample make of Samba version 2.0.4 on a Linux server:</p><PRE CLASS="programlisting"><CODE CLASS="literal"># </code>make 57Using FLAGS = -O -Iinclude -I./include -I./ubiqx -I./smbwrapper -DSMBLOGFILE="/usr/local/samba/var/log.smb" -DNMBLOGFILE="/usr/local/samba/var/log.nmb" -DCONFIGFILE="/usr/local/samba/lib/smb.conf" -DLMHOSTSFILE="/usr/local/samba/lib/lmhosts" -DSWATDIR="/usr/local/samba/swat" -DSBINDIR="/usr/local/samba/bin" -DLOCKDIR="/usr/local/samba/var/locks" -DSMBRUN="/usr/local/samba/bin/smbrun" -DCODEPAGEDIR="/usr/local/samba/lib/codepages" -DDRIVERFILE="/usr/local/samba/lib/printers.def" -DBINDIR="/usr/local/samba/bin" -DHAVE_INCLUDES_H -DPASSWD_PROGRAM="/bin/passwd" -DSMB_PASSWD_FILE="/usr/local/samba/private/smbpasswd" 58Using FLAGS32 = -O -Iinclude -I./include -I./ubiqx -I./smbwrapper -DSMBLOGFILE="/usr/local/samba/var/log.smb" -DNMBLOGFILE="/usr/local/samba/var/log.nmb" -DCONFIGFILE="/usr/local/samba/lib/smb.conf" -DLMHOSTSFILE="/usr/local/samba/lib/lmhosts" -DSWATDIR="/usr/local/samba/swat" -DSBINDIR="/usr/local/samba/bin" -DLOCKDIR="/usr/local/samba/var/locks" -DSMBRUN="/usr/local/samba/bin/smbrun" -DCODEPAGEDIR="/usr/local/samba/lib/codepages" -DDRIVERFILE="/usr/local/samba/lib/printers.def" -DBINDIR="/usr/local/samba/bin" -DHAVE_INCLUDES_H -DPASSWD_PROGRAM="/bin/passwd" -DSMB_PASSWD_FILE="/usr/local/samba/private/smbpasswd" 59Using LIBS = -lreadline -ldl -lcrypt -lpam 60Compiling smbd/server.c 61Compiling smbd/files.c 62Compiling smbd/chgpasswd.c 63 64<EM CLASS="emphasis">...(content omitted)...</em> 65 66Compiling rpcclient/cmd_samr.c 67Compiling rpcclient/cmd_reg.c 68Compiling rpcclient/cmd_srvsvc.c 69Compiling rpcclient/cmd_netlogon.c 70Linking bin/rpcclient 71Compiling utils/smbpasswd.c 72Linking bin/smbpasswd 73Compiling utils/make_smbcodepage.c 74Linking bin/make_smbcodepage 75Compiling utils/nmblookup.c 76Linking bin/nmblookup 77Compiling utils/make_printerdef.c 78Linking bin/make_printerdef</pre><P CLASS="para"> 79If you encounter problems when compiling, check the Samba documentation to see if it is easily fixable. Another possibility is to search or post to the Samba mailing lists, which are given at the end of <a href="ch09_03.html">Chapter 9</a>, and on the Samba home page. Most compilation issues are system specific and almost always easy to overcome.</p><P CLASS="para"> 80Now that the files have been compiled, you can install them into the directories you identified with the command:</p><PRE CLASS="programlisting"># <CODE CLASS="userinput"><B>make install</b></code></pre><P CLASS="para"> 81If you happen to be upgrading, your old Samba files will be saved with the extension <EM CLASS="emphasis"> 82 .old</em>, and you can go back to that previous version with the command <CODE CLASS="literal"> 83make</code> <CODE CLASS="literal"> 84revert</code>. After doing a <CODE CLASS="literal"> 85make</code> <CODE CLASS="literal"> 86install</code>, you should copy the <EM CLASS="emphasis"> 87.old </em>files (if they exist) to a new location or name. Otherwise, the next time you install Samba, the original <EM CLASS="emphasis"> 88.old</em> will be overwritten without warning and you could lose your earlier version. If you configured Samba to use the default locations for files, the new files will be installed in the directories listed in <A CLASS="xref" HREF="ch02_03.html#ch02-pgfId-939627"> 89Table 2.2</a>. Remember that you need to perform the installation from an account that has write privileges on these target directories; this is typically the root account. </p><br> 90<TABLE CLASS="table" BORDER="1" CELLPADDING="3"> 91<CAPTION CLASS="table"> 92<A CLASS="title" NAME="ch02-pgfId-939627"> 93Table 2.2: Samba Installation Directories </a></caption><THEAD CLASS="thead"> 94<TR CLASS="row" VALIGN="TOP"> 95<TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 96<P CLASS="para"> 97Directory</p></th><TH CLASS="entry" ALIGN="LEFT" ROWSPAN="1" COLSPAN="1"> 98<P CLASS="para"> 99Description</p></th></tr></thead><TBODY CLASS="tbody"> 100<TR CLASS="row" VALIGN="TOP"> 101<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 102<P CLASS="para"> 103<EM CLASS="emphasis"> 104/usr/local/samba</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 105<P CLASS="para">Main tree</p></td></tr><TR CLASS="row" VALIGN="TOP"> 106<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 107<P CLASS="para"> 108<EM CLASS="emphasis"> 109/usr/local/samba/bin</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 110<P CLASS="para"> 111Binaries</p></td></tr><TR CLASS="row" VALIGN="TOP"> 112<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 113<P CLASS="para"> 114<EM CLASS="emphasis"> 115/usr/local/samba/lib</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 116<P CLASS="para"> 117<EM CLASS="emphasis"> 118smb.conf</em>, <EM CLASS="emphasis"> 119lmhosts</em>, configuration files, etc.</p></td></tr><TR CLASS="row" VALIGN="TOP"> 120<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 121<P CLASS="para"> 122<EM CLASS="emphasis"> 123/usr/local/samba/man</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 124<P CLASS="para"> 125Samba documentation</p></td></tr><TR CLASS="row" VALIGN="TOP"> 126<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 127<P CLASS="para"> 128<EM CLASS="emphasis"> 129/usr/local/samba/private</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 130<P CLASS="para"> 131Samba encrypted password file</p></td></tr><TR CLASS="row" VALIGN="TOP"> 132<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 133<P CLASS="para"> 134<EM CLASS="emphasis"> 135/usr/local/samba/swat</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 136<P CLASS="para"> 137SWAT files</p></td></tr><TR CLASS="row" VALIGN="TOP"> 138<TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 139<P CLASS="para"> 140<EM CLASS="emphasis"> 141/usr/local/samba/var</em></p></td><TD CLASS="entry" ROWSPAN="1" COLSPAN="1"> 142<P CLASS="para"> 143Samba log files, lock files, browse list info, shared memory files, process ID files</p></td></tr></tbody></table><P CLASS="para"> 144Throughout the remainder of the book, we occasionally refer to the location of the main tree as <CODE CLASS="replaceable"> 145<I> 146samba_dir</i></code>. In most configurations, this is the base directory of the installed Samba package: <I CLASS="filename"> 147/usr/local/samba</i>.</p><BLOCKQUOTE CLASS="warning"> 148<P CLASS="para"> 149<STRONG> 150WARNING:</strong> Watch out if you've made <I CLASS="filename"> 151/usr</i> a read-only partition. You will want to put the logs, locks, and password files somewhere else.</p></blockquote><P CLASS="para"> 152Here is the installation that we performed on our machine. You can see that we used <I CLASS="filename"> 153/usr/local/samba</i> as the base directory for the distribution (e.g., <CODE CLASS="replaceable"> 154<I> 155samba_dir</i></code>):</p><PRE CLASS="programlisting"> 156# <CODE CLASS="userinput"><B>make install</b></code> 157Using FLAGS = -O -Iinclude -I./include -I./ubiqx -I./smbwrapper -DSMBLOGFILE="/usr/local/samba/var/log.smb" -DNMBLOGFILE="/usr/local/samba/var/log.nmb" -DCONFIGFILE="/usr/local/samba/lib/smb.conf" - 158 159<I CLASS="lineannotation">...(content omitted)...</i> 160 161The binaries are installed. You may restore the old binaries 162(if there were any) using the command "make revert". You may 163uninstall the binaries using the command "make uninstallbin" 164or "make uninstall" to uninstall binaries, man pages and shell 165scripts. 166 167<I CLASS="lineannotation">...(content omitted)...</i> 168 169============================================================ 170The SWAT files have been installed. Remember to read the 171README for information on enabling and using SWAT. 172============================================================</pre><P CLASS="para"> 173If the last message is about SWAT, you've successfully installed all the files. Congratulations! You now have Samba on your system!</p><DIV CLASS="sect2"> 174<H3 CLASS="sect2"> 175<A CLASS="title" NAME="ch02-pgfId-943188"> 1762.3.1 Final Installation Steps</a></h3><P CLASS="para">There are a couple of final steps to perform. Specifically, add the Samba Web Administration Tool (SWAT) to the <I CLASS="filename"> 177/etc/services</i> and <I CLASS="filename"> 178/etc/inetd.conf</i> configuration files. SWAT runs as a daemon under <EM CLASS="emphasis"> 179inetd</em> and provides a forms-based editor in your web browser for creating and modifying SMB configuration files.</p><OL CLASS="orderedlist"> 180<LI CLASS="listitem"> 181<P CLASS="para"> 182<A CLASS="listitem" NAME="ch02-pgfId-943198"> 183</a>To add SWAT, add the following line to the end of the <I CLASS="filename"> 184/etc/services</i> file:</p></li></ol><PRE CLASS="programlisting"> 185swat 901/tcp</pre><OL CLASS="orderedlist" START="2"> 186<LI CLASS="listitem"> 187<P CLASS="para"> 188<A CLASS="listitem" NAME="ch02-pgfId-938792"> 189</a>Add these lines to <I CLASS="filename"> 190/etc/inetd.conf.</i> (Check your <I CLASS="filename"> 191inetd.conf</i> manual page to see the exact format of the<I CLASS="filename"> 192 inetd.conf</i> file if it differs from the following example.) Don't forget to change the path to the SWAT binary if you installed it in a different location from the default <I CLASS="filename"> 193/usr/local/samba</i>.</p></li></ol><PRE CLASS="programlisting"> 194swat stream tcp nowait.400 root /usr/local/samba/bin/swat swat</pre><P CLASS="para"> 195And that's pretty much it for the installation. Before you can start up Samba, however, you need to create a configuration file for it. </p></div></div></blockquote> 196<div> 197<center> 198<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 199<TR> 200<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 201<A CLASS="sect1" HREF="ch02_02.html" TITLE="2.2 Configuring Samba"> 202<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 2.2 Configuring Samba" BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 203<A CLASS="book" HREF="index.html" TITLE=""> 204<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 205<A CLASS="sect1" HREF="ch02_04.html" TITLE="2.4 A Basic Samba Configuration File"> 206<IMG SRC="gifs/txtnexta.gif" ALT="Next: 2.4 A Basic Samba Configuration File" BORDER="0"></a></td></tr><TR> 207<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 2082.2 Configuring Samba</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 209<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 210<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 2112.4 A Basic Samba Configuration File</td></tr></table><hr noshade size=1></center> 212</div> 213 214<!-- End of sample chapter --> 215<CENTER> 216<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 217<A HREF="http://www.oreilly.com/"> 218<B>O'Reilly Home</B></A> <B> | </B> 219<A HREF="http://www.oreilly.com/sales/bookstores"> 220<B>O'Reilly Bookstores</B></A> <B> | </B> 221<A HREF="http://www.oreilly.com/order_new/"> 222<B>How to Order</B></A> <B> | </B> 223<A HREF="http://www.oreilly.com/oreilly/contact.html"> 224<B>O'Reilly Contacts<BR></B></A> 225<A HREF="http://www.oreilly.com/international/"> 226<B>International</B></A> <B> | </B> 227<A HREF="http://www.oreilly.com/oreilly/about.html"> 228<B>About O'Reilly</B></A> <B> | </B> 229<A HREF="http://www.oreilly.com/affiliates.html"> 230<B>Affiliated Companies</B></A><p> 231<EM>© 1999, O'Reilly & Associates, Inc.</EM> 232</FONT> 233</CENTER> 234</BODY> 235</html> 236