1<HTML> 2<HEAD> 3<TITLE> 4[Chapter 2] Installing Samba on a Unix System</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:03Z"><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="ch01_08.html" TITLE="1.8 And That's Not All..."> 35<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 1.8 And That's Not All..." BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 36<B> 37<FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1"> 38Chapter 2</font></b></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 39<A CLASS="sect1" HREF="ch02_02.html" TITLE="2.2 Configuring Samba"> 40<IMG SRC="gifs/txtnexta.gif" ALT="Next: 2.2 Configuring Samba" BORDER="0"></a></td></tr></table> <hr noshade size=1></center> 41</div> 42<blockquote> 43<div class="samplechapter"> 44<H1 CLASS="chapter"> 45<A CLASS="title" NAME="ch02-46174"> 462. Installing Samba on a Unix System</a></h1><DIV CLASS="htmltoc"> 47<P> 48<B> 49Contents:</b><br> 50<A CLASS="sect1" HREF="#ch02-85028" TITLE="2.1 Downloading the Samba Distribution"> 51Downloading the Samba Distribution</a><br> 52<A CLASS="sect1" HREF="ch02_02.html" TITLE="2.2 Configuring Samba"> 53Configuring Samba</a><br> 54<A CLASS="sect1" HREF="ch02_03.html" TITLE="2.3 Compiling and Installing Samba"> 55Compiling and Installing Samba</a><br> 56<A CLASS="sect1" HREF="ch02_04.html" TITLE="2.4 A Basic Samba Configuration File"> 57A Basic Samba Configuration File</a><br> 58<A CLASS="sect1" HREF="ch02_05.html" TITLE="2.5 Starting the Samba Daemons"> 59Starting the Samba Daemons</a><br> 60<A CLASS="sect1" HREF="ch02_06.html" TITLE="2.6 Testing the Samba Daemons"> 61Testing the Samba Daemons</a></p><P> 62</p></div><P CLASS="para">Now that you know what Samba can do for you and your users, it's time to get your own network set up. Let's start with the installation of Samba itself on a Unix system. When dancing the samba, one learns by taking small steps. It's just the same when installing Samba; we need to teach it step by step. This chapter will help you to start off on the right foot. </p><P CLASS="para"> 63For illustrative purposes, we will be installing the 2.0.4 version of the Samba server on a Linux[<A CLASS="footnote" HREF="#ch02-pgfId-939741">1</a>] system running version 2.0.31 of the kernel. However, the installation steps are the same for all of the platforms that Samba supports. A typical installation will take about an hour to complete, including downloading the source files and compiling them, setting up the configuration files, and testing the server. </p><BLOCKQUOTE CLASS="footnote"> 64<DIV CLASS="footnote"> 65<P CLASS="para"> 66<A CLASS="footnote" NAME="ch02-pgfId-939741">[1]</a> If you haven't heard of Linux yet, then you're in for a treat. Linux is a freely distributed Unix-like operating system that runs on the Intel x86, Motorola PowerPC, and Sun Sparc platforms. The operating system is relatively easy to configure, extremely robust, and is gaining in popularity. You can get more information on the Linux operating system at <a href="http://www.linux.org/"><EM CLASS="emphasis">http://www.linux.org/</a></em>.</p></div></blockquote><P CLASS="para">Here is an overview of the steps:</p><OL CLASS="orderedlist"> 67<LI CLASS="listitem"> 68<P CLASS="para"> 69<A CLASS="listitem" NAME="ch02-pgfId-938543"> 70</a>Download the source or binary files.</p></li><LI CLASS="listitem"> 71<P CLASS="para"> 72<A CLASS="listitem" NAME="ch02-pgfId-938544"> 73</a>Read the installation documentation.</p></li><LI CLASS="listitem"> 74<P CLASS="para"> 75<A CLASS="listitem" NAME="ch02-pgfId-938545"> 76</a>Configure a makefile.</p></li><LI CLASS="listitem"> 77<P CLASS="para"> 78<A CLASS="listitem" NAME="ch02-pgfId-938546"> 79</a>Compile the server code.</p></li><LI CLASS="listitem"> 80<P CLASS="para"> 81<A CLASS="listitem" NAME="ch02-pgfId-938547"> 82</a>Install the server files.</p></li><LI CLASS="listitem"> 83<P CLASS="para"> 84<A CLASS="listitem" NAME="ch02-pgfId-938548"> 85</a>Create a Samba configuration file.</p></li><LI CLASS="listitem"> 86<P CLASS="para"> 87<A CLASS="listitem" NAME="ch02-pgfId-938549"> 88</a>Test the configuration file.</p></li><LI CLASS="listitem"> 89<P CLASS="para"> 90<A CLASS="listitem" NAME="ch02-pgfId-938550"> 91</a>Start the Samba daemons.</p></li><LI CLASS="listitem"> 92<P CLASS="para"> 93<A CLASS="listitem" NAME="ch02-pgfId-938551"> 94</a>Test the Samba daemons.</p></li></ol><DIV CLASS="sect1"> 95<H2 CLASS="sect1"> 96<A CLASS="title" NAME="s1"></a> 97<A CLASS="title" NAME="ch02-85028"> 982.1 Downloading the Samba Distribution</a></h2><P CLASS="para">If you want to get started quickly, the CD-ROM packaged with this book contains both the sources and binaries of Samba that were available as this book went to print. The CD is a mirror image of the files and directories on the Samba download server: <EM CLASS="emphasis"> 99ftp.samba.org</em>.</p><P CLASS="para"> 100On the other hand, if you want to download the latest version, the primary web site for the Samba software is <A CLASS="systemitem.url" HREF="http://www.samba.org">http://www.samba.org</a>. Once connected to this page, you'll see links to several Samba mirror sites across the world, both for the standard Samba web pages and sites devoted exclusively to downloading Samba. For the best performance, choose a site that is closest to your own geographic location.</p><P CLASS="para"> 101The standard Samba web sites have Samba documentation and tutorials, mailing list archives, and the latest Samba news, as well as source and binary distributions of Samba. The download sites (sometimes called <EM CLASS="emphasis"> 102FTP sites</em>) have only the source and binary distributions. Unless you specifically want an older version of the Samba server or are going to install a binary distribution, download the latest source distribution from the closest mirror site. This distribution is always named:</p><PRE CLASS="programlisting">samba-latest.tar.gz</pre><P CLASS="para"> 103If you choose to use the version of Samba that is located on the CD-ROM packaged with this book, you should find the latest Samba distribution in the base directory.</p><DIV CLASS="sect2"> 104<H3 CLASS="sect2"> 105<A CLASS="title" NAME="ch02-pgfId-938556"> 1062.1.1 Binary or Source?</a></h3><P CLASS="para">Precompiled packages are also available for a large number of Unix platforms. These packages contain binaries for each of the Samba executables as well as the standard Samba documentation. Note that while installing a binary distribution can save you a fair amount of trouble and time, there are a couple of issues that you should keep in mind when deciding whether to use the binary or compile the source yourself:</p><UL CLASS="itemizedlist"> 107<LI CLASS="listitem"> 108<P CLASS="para"> 109<A CLASS="listitem" NAME="ch02-pgfId-938558"> 110</a>The binary packages can lag behind the latest version of the software by one or two (maybe more) minor releases, especially after a series of small changes and for less popular platforms. Compare the release notes for the source and binary packages to make sure that there aren't any new features that you need on your platform. This is especially true of the sources and binaries on the CD-ROM: at the time this book went to print, they were from the latest production release of Samba. However, development is ongoing, so the beta-test versions on the Internet will be newer.</p></li><LI CLASS="listitem"> 111<P CLASS="para"> 112<A CLASS="listitem" NAME="ch02-pgfId-938560"> 113</a>If you use a precompiled binary, you will need to ensure that you have the correct libraries required by the executables. On some platforms the executables are statically linked so this isn't an issue, but on modern Unix operating systems (e.g., Linux, SGI Irix, Solaris, HP-UX, etc.), libraries are often dynamically linked. This means that the binary looks for the right version of each library on your system, so you may have to install a new version of a library. The <I CLASS="filename"> 114README</i> file or <I CLASS="filename"> 115makefile</i> that accompanies the binary distribution should list any special requirements.[<A CLASS="footnote" HREF="#ch02-pgfId-943622">2</a>]</p><BLOCKQUOTE CLASS="footnote"> 116<DIV CLASS="footnote"> 117<P CLASS="para"> 118<A CLASS="footnote" NAME="ch02-pgfId-943622">[2]</a> This is especially true with programs that use <EM CLASS="emphasis"> 119glibc-2.1</em> (which comes standard with Red Hat Linux 6). This library caused quite a consternation in the development community when it was released because it was incompatable with previous versions of <EM CLASS="emphasis">g</em><I CLASS="filename">libc</i>.</p></div></blockquote><P CLASS="para">Many machines with shared libraries come with a nifty tool called <EM CLASS="emphasis">ldd</em>. This tool will tell you which libraries a specific binary requires and which libraries on the system satisfy that requirement. For example, checking the <EM CLASS="emphasis"> 120smbd</em> program on our test machine gave us:</p></li></ul><PRE CLASS="programlisting"><B CLASS="emphasis.bold"><CODE CLASS="literal">$</code> ldd smbd</b> 121</pre><PRE CLASS="programlisting"> 122libreadline.so.3 => /usr/lib/libreadline.so.3 123libdl.so.2 => /lib/libdl.so.2 124libcrypt.so.1 => /lib/libcrypt.so.1 125libc.so.6 => /lib/libc.so.6 126libtermcap.so.2 => /lib/libtermcap.so.2 127/lib/ld-linux.so.2 => /lib/ld-linux.so.2</pre><UL CLASS="itemizedlist"> 128<LI CLASS="listitem"> 129<P CLASS="para"> 130If there are any incompatibilities between Samba and specific libraries on your machine, the distribution-specific documentation should highlight those.</p></li><LI CLASS="listitem"> 131<P CLASS="para"> 132<A CLASS="listitem" NAME="ch02-pgfId-938567"> 133</a>Keep in mind that each binary distribution carries preset values about the target platform, such as default directories and configuration option values. Again, check the documentation and the makefile included in the source directory to see which directives and variables were used when the binary was compiled. In some cases, these will not be appropriate for your situation. </p><P CLASS="para"> 134A few configuration items can be reset with command-line options at runtime instead of at compile time. For example, if your binary tries to place any log, lock, or status files in the "wrong" place (for example, in <I CLASS="filename"> 135/usr/local</i>), you can override this without recompiling. </p></li></ul><P CLASS="para"> 136One point worth mentioning is that the Samba source requires an ANSI C compiler. If you are on a platform with a non-ANSI compiler, such as the <EM CLASS="emphasis"> 137cc</em> compiler on SunOS version 4, you'll have to install an ANSI-compliant compiler such as <EM CLASS="emphasis"> 138gcc </em>before you do anything else.[<A CLASS="footnote" HREF="#ch02-pgfId-939049">3</a>] If installing a compiler isn't something you want to wrestle with, you can start off with a binary package. However, for the most flexibility and compatibility on your system, we always recommend compiling from the latest source.</p><BLOCKQUOTE CLASS="footnote"> 139<DIV CLASS="footnote"> 140<P CLASS="para"> 141<A CLASS="footnote" NAME="ch02-pgfId-939049">[3]</a> <EM CLASS="emphasis"> 142gcc</em> binaries are available for almost every modern machine. See <A CLASS="systemitem.url" HREF="http://www.gnu.org/"> 143http://www.gnu.org/</a> for a list of sites with <EM CLASS="emphasis"> 144gcc</em> and other GNU software.</p></div></blockquote></div><DIV CLASS="sect2"> 145<H3 CLASS="sect2"> 146<A CLASS="title" NAME="ch02-pgfId-938574"> 1472.1.2 Read the Documentation</a></h3><P CLASS="para">This sounds like an obvious thing to say, but there have probably been times where you have uncompressed a package, blindly typed <CODE CLASS="literal"> 148configure</code>, <CODE CLASS="literal"> 149make</code>, and <CODE CLASS="literal"> 150make</code> <CODE CLASS="literal"> 151install</code>, and walked away to get another cup of coffee. We'll be the first to admit that we do that, many more times than we should. It's a bad idea - especially when planning a network with Samba.</p><P CLASS="para"> 152Samba 2.0 automatically configures itself prior to compilation. This reduces the likelihood of a machine-specific problem, but there may be an option mentioned in the <I CLASS="filename"> 153README</i> file that you end up wishing for after Samba's been installed. With both source and binary packages you'll find a large number of documents in the <I CLASS="filename"> 154docs</i> directory, in a variety of formats. The most important files to look at in the distribution are:</p><PRE CLASS="programlisting"> 155WHATSNEW.txt 156docs/textdocs/UNIX_INSTALL.txt</pre><P CLASS="para"> 157These files tell you what features you can expect in your Samba distribution, and will highlight common installation problems that you're likely to face. Be sure to look over both of them before you start the compilation process. </p></div></div></div></blockquote> 158<div> 159<center> 160<hr noshade size=1><TABLE WIDTH="515" BORDER="0" CELLSPACING="0" CELLPADDING="0"> 161<TR> 162<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 163<A CLASS="sect1" HREF="ch01_08.html" TITLE="1.8 And That's Not All..."> 164<IMG SRC="gifs/txtpreva.gif" ALT="Previous: 1.8 And That's Not All..." BORDER="0"></a></td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 165<A CLASS="book" HREF="index.html" TITLE=""> 166<IMG SRC="gifs/txthome.gif" ALT="" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 167<A CLASS="sect1" HREF="ch02_02.html" TITLE="2.2 Configuring Samba"> 168<IMG SRC="gifs/txtnexta.gif" ALT="Next: 2.2 Configuring Samba" BORDER="0"></a></td></tr><TR> 169<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="172"> 1701.8 And That's Not All...</td><TD ALIGN="CENTER" VALIGN="TOP" WIDTH="171"> 171<A CLASS="index" HREF="inx.html" TITLE="Book Index"> 172<IMG SRC="gifs/index.gif" ALT="Book Index" BORDER="0"></a></td><TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="172"> 1732.2 Configuring Samba</td></tr></table><hr noshade size=1></center> 174</div> 175 176<!-- End of sample chapter --> 177<CENTER> 178<FONT SIZE="1" FACE="Verdana, Arial, Helvetica"> 179<A HREF="http://www.oreilly.com/"> 180<B>O'Reilly Home</B></A> <B> | </B> 181<A HREF="http://www.oreilly.com/sales/bookstores"> 182<B>O'Reilly Bookstores</B></A> <B> | </B> 183<A HREF="http://www.oreilly.com/order_new/"> 184<B>How to Order</B></A> <B> | </B> 185<A HREF="http://www.oreilly.com/oreilly/contact.html"> 186<B>O'Reilly Contacts<BR></B></A> 187<A HREF="http://www.oreilly.com/international/"> 188<B>International</B></A> <B> | </B> 189<A HREF="http://www.oreilly.com/oreilly/about.html"> 190<B>About O'Reilly</B></A> <B> | </B> 191<A HREF="http://www.oreilly.com/affiliates.html"> 192<B>Affiliated Companies</B></A><p> 193<EM>© 1999, O'Reilly & Associates, Inc.</EM> 194</FONT> 195</CENTER> 196</BODY> 197</html> 198