2004-06-06 02:01:16 +04:00
<?xml version="1.0" encoding="iso-8859-1"?>
2005-03-13 19:21:54 +03:00
<!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
2004-04-07 14:15:11 +04:00
<chapter id= "compiling" >
<chapterinfo >
&author.jelmer;
&author.jht;
&author.tridge;
<pubdate > 22 May 2001 </pubdate>
<pubdate > 18 March 2003 </pubdate>
2005-06-29 02:12:01 +04:00
<pubdate > June 2005 </pubdate>
2004-04-07 14:15:11 +04:00
</chapterinfo>
<title > How to Compile Samba</title>
<para >
2005-05-25 11:08:30 +04:00
You can obtain the Samba source file from the
2005-06-16 06:10:11 +04:00
<ulink url= "http://samba.org/" > Samba Web site</ulink> . To obtain a development version,
2004-04-19 18:48:09 +04:00
you can download Samba from Subversion or using <command > rsync</command> .
2004-04-07 14:15:11 +04:00
</para>
<sect1 >
2012-09-15 09:28:19 +04:00
<title > Access Samba Source Code via GIT</title>
2004-04-07 14:15:11 +04:00
<sect2 >
<title > Introduction</title>
<para >
2004-04-19 18:48:09 +04:00
<indexterm > <primary > Subversion</primary> </indexterm>
2012-09-15 09:28:19 +04:00
Samba is developed in an open environment. Developers use
GIT to <quote > checkin</quote> (also known as
<quote > commit</quote> ) new source code. See the
<ulink noescape= "1"
url="https://wiki.samba.org/index.php/Using_Git_for_Samba_Development">Using
Git for Samba Development page</ulink> in the Samba wiki.
2004-04-07 14:15:11 +04:00
</para>
</sect2>
</sect1>
<sect1 >
<title > Accessing the Samba Sources via rsync and ftp</title>
<para >
<indexterm > <primary > rsync</primary> </indexterm>
<indexterm > <primary > ftp</primary> </indexterm>
2005-06-29 12:21:42 +04:00
<parameter > pserver.samba.org</parameter> also exports unpacked copies of most parts of the Subversion tree
2012-09-15 09:29:05 +04:00
at the Samba <ulink noescape= "1" url= "ftp://samba.org/pub/unpacked" > unpacked</ulink> location and also
2005-06-29 12:21:42 +04:00
via anonymous rsync at the Samba <ulink noescape= "1"
2012-09-15 09:29:05 +04:00
url="rsync://samba.org/ftp/unpacked/">rsync</ulink> server location. I recommend using rsync rather
2005-06-29 12:21:42 +04:00
than ftp, because rsync is capable of compressing data streams, but it is also more useful than FTP because
during a partial update it will transfer only the data that is missing plus a small overhead. See <ulink
noescape="1" url="http://rsync.samba.org/">the rsync home page</ulink> for more info on rsync.
2004-04-07 14:15:11 +04:00
</para>
<para >
The disadvantage of the unpacked trees is that they do not support automatic
2012-09-15 09:28:19 +04:00
merging of local changes as GIT does. <command > rsync</command> access is most convenient
2004-04-07 14:15:11 +04:00
for an initial install.
</para>
</sect1>
<sect1 >
<title > Verifying Samba's PGP Signature</title>
<para >
<indexterm > <primary > GPG</primary> </indexterm>
2005-06-29 02:12:01 +04:00
<indexterm > <primary > PGP</primary> </indexterm>
2004-04-07 14:15:11 +04:00
It is strongly recommended that you verify the PGP signature for any source file before
installing it. Even if you're not downloading from a mirror site, verifying PGP signatures
2005-06-16 06:10:11 +04:00
should be a standard reflex. Many people today use the GNU GPG tool set in place of PGP.
2004-04-07 14:15:11 +04:00
GPG can substitute for PGP.
</para>
<para >
With that said, go ahead and download the following files:
</para>
<para > <screen >
2012-09-15 09:29:05 +04:00
&prompt; <userinput > wget http://samba.org/samba/ftp/samba-latest.tar.asc</userinput>
&prompt; <userinput > wget http://samba.org/samba/ftp/samba-latest.tar.gz</userinput>
&prompt; <userinput > wget http://samba.org/samba/ftp/samba-pubkey.asc</userinput>
2004-04-07 14:15:11 +04:00
</screen> </para>
<para >
<indexterm > <primary > PGP</primary> </indexterm>
The first file is the PGP signature for the Samba source file; the other is the Samba public
PGP key itself. Import the public PGP key with:
<screen >
&prompt; <userinput > gpg --import samba-pubkey.asc</userinput>
</screen>
and verify the Samba source code integrity with:
<screen >
2012-09-15 09:29:05 +04:00
&prompt; <userinput > gzip -d samba-latest.tar.gz</userinput>
&prompt; <userinput > gpg --verify samba-latest.tar.asc</userinput>
2004-04-07 14:15:11 +04:00
</screen>
2005-06-29 02:12:01 +04:00
</para>
2004-04-07 14:15:11 +04:00
<para >
2005-06-16 06:10:11 +04:00
If you receive a message like, <quote > Good signature from Samba Distribution Verification Key...,</quote>
2004-04-07 14:15:11 +04:00
then all is well. The warnings about trust relationships can be ignored. An
example of what you would not want to see would be:
2005-06-29 02:12:01 +04:00
<screen >
gpg: BAD signature from <quote > Samba Distribution Verification Key</quote>
</screen>
2004-04-07 14:15:11 +04:00
</para>
</sect1>
<sect1 >
<title > Building the Binaries</title>
<para >
2004-12-22 01:25:23 +03:00
<indexterm > <primary > configure</primary> </indexterm>
To build the binaries, run the program <userinput > ./configure
2013-05-21 14:44:26 +04:00
</userinput> in the top level directory of the source tree. This should automatically
2004-04-07 14:15:11 +04:00
configure Samba for your operating system. If you have unusual
2005-06-16 06:10:11 +04:00
needs, then you may wish to first run:
2005-05-25 08:08:26 +04:00
<screen >
&rootprompt; <userinput > ./configure --help</userinput>
</screen>
</para>
2004-04-07 14:15:11 +04:00
<para >
2005-05-25 08:08:26 +04:00
This will help you to see what special options can be enabled. Now execute
<userinput > ./configure</userinput> with any arguments it might need:
<screen >
&rootprompt; <userinput > ./configure <replaceable > [... arguments ...]</replaceable> </userinput>
</screen>
</para>
2004-04-07 14:15:11 +04:00
2005-05-25 08:08:26 +04:00
<para >
<indexterm > <primary > make</primary> </indexterm>
Execute the following create the binaries:
<screen >
&rootprompt; <userinput > make</userinput>
</screen>
2005-06-16 06:10:11 +04:00
Once it is successfully compiled, you can execute the command shown here to
2005-05-25 08:08:26 +04:00
install the binaries and manual pages:
<screen >
&rootprompt; <userinput > make install</userinput>
</screen>
</para>
2004-04-07 14:15:11 +04:00
<sect2 >
<title > Compiling Samba with Active Directory Support</title>
2005-05-25 08:08:26 +04:00
<para >
In order to compile Samba with ADS support, you need to have installed
on your system:
</para>
2004-04-07 14:15:11 +04:00
<itemizedlist >
2005-05-25 08:08:26 +04:00
<listitem > <para >
The MIT or Heimdal Kerberos development libraries
(either install from the sources or use a package).
</para> </listitem>
2004-04-07 14:15:11 +04:00
2005-05-25 08:08:26 +04:00
<listitem > <para >
The OpenLDAP development libraries.
</para> </listitem>
2004-04-07 14:15:11 +04:00
</itemizedlist>
2005-05-25 08:08:26 +04:00
<para >
2005-06-16 06:10:11 +04:00
If your Kerberos libraries are in a nonstandard location, then
2005-05-25 08:08:26 +04:00
remember to add the configure option
<option > --with-krb5=<replaceable > DIR</replaceable> </option> .
</para>
2004-04-07 14:15:11 +04:00
2005-05-25 08:08:26 +04:00
<para >
2005-06-16 06:10:11 +04:00
After you run configure, make sure that the
2013-05-21 14:44:26 +04:00
<filename > bin/default/include/config.h</filename> it generates contain lines like this:
2005-05-25 08:08:26 +04:00
<programlisting >
2004-04-07 14:15:11 +04:00
#define HAVE_KRB5 1
#define HAVE_LDAP 1
2005-05-25 08:08:26 +04:00
</programlisting>
</para>
2004-04-07 14:15:11 +04:00
2005-05-25 08:08:26 +04:00
<para >
If it does not, configure did not find your KRB5 libraries or
2013-05-21 14:44:26 +04:00
your LDAP libraries. Look in <filename > bin/config.log</filename> to figure
2005-05-25 08:08:26 +04:00
out why and fix it.
</para>
2004-04-07 14:15:11 +04:00
<sect3 >
<title > Installing the Required Packages for Debian</title>
<para > On Debian, you need to install the following packages:</para>
<para >
<itemizedlist >
2004-09-05 18:46:49 +04:00
<listitem > <para > libkrb5-dev</para> </listitem>
<listitem > <para > krb5-user</para> </listitem>
2004-04-07 14:15:11 +04:00
</itemizedlist>
</para>
</sect3>
<sect3 >
<title > Installing the Required Packages for Red Hat Linux</title>
<para > On Red Hat Linux, this means you should have at least: </para>
<para >
<itemizedlist >
2004-09-05 18:46:49 +04:00
<listitem > <para > krb5-workstation (for kinit)</para> </listitem>
<listitem > <para > krb5-libs (for linking with)</para> </listitem>
<listitem > <para > krb5-devel (because you are compiling from source)</para> </listitem>
2004-04-07 14:15:11 +04:00
</itemizedlist>
</para>
<para > in addition to the standard development environment.</para>
<para > If these files are not installed on your system, you should check the installation
CDs to find which has them and install the files using your tool of choice. If in doubt
about what tool to use, refer to the Red Hat Linux documentation.</para>
</sect3>
<sect3 >
<title > SuSE Linux Package Requirements</title>
2005-05-25 08:08:26 +04:00
<para >
SuSE Linux installs Heimdal packages that may be required to allow you to build
2004-04-07 14:15:11 +04:00
binary packages. You should verify that the development libraries have been installed on
your system.
</para>
2005-05-25 08:08:26 +04:00
<para >
SuSE Linux Samba RPMs support Kerberos. Please refer to the documentation for
2004-04-07 14:15:11 +04:00
your SuSE Linux system for information regarding SuSE Linux specific configuration.
2005-06-16 06:10:11 +04:00
Additionally, SuSE is very active in the maintenance of Samba packages that provide
the maximum capabilities that are available. You should consider using SuSE-provided
2004-04-07 14:15:11 +04:00
packages where they are available.
</para>
</sect3>
</sect2>
</sect1>
2005-06-17 12:37:51 +04:00
<sect1 id= "startingSamba" >
2005-05-31 21:34:35 +04:00
<title > Starting the &smbd; &nmbd; and &winbindd; </title>
2004-04-07 14:15:11 +04:00
<para >
<indexterm > <primary > inetd</primary> </indexterm>
2005-05-25 11:30:49 +04:00
You must choose to start &smbd; , &winbindd; and &nmbd; either as daemons or from
2005-05-25 08:08:26 +04:00
<application > inetd</application> . Don't try to do both! Either you can put
them in <filename > inetd.conf</filename> and have them started on demand by
<application > inetd</application> or <application > xinetd</application> , or you
2005-06-16 06:10:11 +04:00
can start them as daemons either from the command-line or in
2005-05-25 08:08:26 +04:00
<filename > /etc/rc.local</filename> . See the man pages for details on the
command line options. Take particular care to read the bit about what user
you need to have to start Samba. In many cases, you must be root.
</para>
<para >
The main advantage of starting &smbd; and &nmbd; using the recommended daemon method
is that they will respond slightly more quickly to an initial connection request.
</para>
2004-04-07 14:15:11 +04:00
<sect2 >
2012-09-15 10:08:53 +04:00
<title > Starting &smbd; as a Daemon</title>
2004-04-07 14:15:11 +04:00
2005-05-25 08:08:26 +04:00
<para >
<indexterm > <primary > daemon</primary> </indexterm>
2005-06-29 02:12:01 +04:00
<indexterm > <primary > startsmb</primary> </indexterm>
2005-05-25 08:08:26 +04:00
To start the server as a daemon, you should create a script something
like this one, perhaps calling it <filename > startsmb</filename> .
</para>
<para > <programlisting >
#!/bin/sh
2009-01-19 10:55:30 +03:00
/usr/local/samba/sbin/smbd -D
/usr/local/samba/sbin/winbindd -D
/usr/local/samba/sbin/nmbd -D
2005-05-25 08:08:26 +04:00
</programlisting> </para>
2005-05-25 11:08:30 +04:00
<para >
2005-06-16 06:10:11 +04:00
Make it executable with <command > chmod +x startsmb</command> .
2005-05-25 11:08:30 +04:00
</para>
2005-05-25 08:08:26 +04:00
2005-05-25 11:08:30 +04:00
<para >
You can then run <command > startsmb</command> by hand or execute
it from <filename > /etc/rc.local</filename> .
</para>
2005-05-25 08:08:26 +04:00
2005-05-25 11:08:30 +04:00
<para >
To kill it, send a kill signal to the processes &nmbd; and &smbd; .
</para>
2004-04-07 14:15:11 +04:00
2005-05-25 11:08:30 +04:00
<note > <para >
2005-06-16 06:10:11 +04:00
If you use the SVR4-style init system, you may like to look at the
2005-05-25 11:08:30 +04:00
<filename > examples/svr4-startup</filename> script to make Samba fit
into that system.
</para> </note>
2004-04-07 14:15:11 +04:00
2005-06-17 12:37:51 +04:00
<sect3 >
<title > Starting Samba for Red Hat Linux</title>
<para >
2005-07-08 10:30:54 +04:00
The process for starting Samba will now be outlined. Be sure to configure Samba's &smb.conf;
2005-06-17 12:37:51 +04:00
file before starting Samba. When configured, start Samba by executing:
<screen >
&rootprompt; service smb start
&rootprompt; service winbind start
</screen>
These steps will start &nmbd; , &smbd; and &winbindd; .
</para>
<para >
To ensure that these services will be automatically restarted when the system is rebooted
execute:
<screen >
&rootprompt; chkconfig smb on
&rootprompt; chkconfig winbind on
</screen>
Samba will be started automatically at every system reboot.
</para>
</sect3>
<sect3 >
<title > Starting Samba for Novell SUSE Linux</title>
<para >
Novell SUSE Linux products automatically install all essential Samba components in a default installation.
Configure your &smb.conf; file, then execute the following to start Samba:
<screen >
&rootprompt; rcnmb start
&rootprompt; rcsmb start
&rootprompt; rcwinbind start
</screen>
Now execute these commands so that Samba will be started automatically following a system
reboot:
<screen >
&rootprompt; chkconfig nmb on
&rootprompt; chkconfig smb on
&rootprompt; chkconfig winbind on
</screen>
The Samba services will now be started automatically following a system reboot.
</para>
</sect3>
2004-04-07 14:15:11 +04:00
</sect2>
2005-05-25 08:08:26 +04:00
2004-04-07 14:15:11 +04:00
</sect1>
</chapter>