Difference between revisions of "Build Samba from Source"

m (Rename OS Requirements link)
(Face-lifting the page (structure, formattings, text changes, remove unneccessary text, etc.), also adapting the page to fit to all Samba builds (not only Samba AD DC))
Line 1: Line 1:
== Samba OS Requirements ==
+
= Introduction =
  
Because of the constantly changing and ever expanding nature of Linux, the [[OS_Requirements|OS Requirements]] page is now self contained.
+
This document describes how to build Samba from source.
This page not only includes the required packages for a successful Samba AD DC deployment, but also the required file system features.  Please consider that page as a prerequisite to a successful Samba AD DC setup.
 
  
== Step 1: Download Samba ==
+
It can be used for any kind of Samba installation (Samba AD DC, Member Server, Samba PDC, etc.).
  
Currently, there are two methods to download the current Samba sources, either as a tarball of the latest stable release, or a development version via git.  If you hope to work with the team on a development version to resolve issues you may hit via code changes, we recommend using the git method for downloading Samba, as it makes getting updates easier, and also allows you to integrate test patches from Samba developers more easily in case of problems.
 
  
In the following examples we will assume that your top-level source is named <tt>samba-master</tt>, <tt>samba-v4-0-stable</tt>, or <tt>samba-v4-0-test</tt> depending on which head you're downloading from.  If you downloaded a tarball this will instead be based on the name of the tarball downloaded (e.g.  <tt>samba-4.0.0</tt> for the tarball samba-4.0.0.tar.gz).  Also note that in the <tt>master</tt> branch the
 
Samba 4 code in our current git tree is now located in the top level directory.
 
  
=== Downloading a tarball ===
 
  
If you wish to use a released version of Samba 4.0, you can download the latest Samba 4.0 tarball from [http://ftp.samba.org/pub/samba/ the Samba website]
 
  
=== Downloading via git ===
+
= Samba Operating System Requirements =
  
Git allows you to download the source tree via either the <tt>git</tt> or <tt>http</tt> protocols. In general, the <tt>git</tt> protocol is the preferred choice since it compresses the data being transferred. To download the source tree via <tt>git</tt>, run the following command:
+
See [[OS_Requirements|OS Requirements]].
 +
 
 +
 
 +
 
 +
 
 +
 
 +
= Obtaining Samba =
 +
 
 +
== Stable version (recommended) ==
 +
 
 +
You can download the latest version of Samba from [https://www.samba.org/ https://www.samba.org/].
 +
 
 +
It is always recommended that you install the latest version of the [[Samba_Release_Planning#Current_Stable_Release|current stable release]]. If you require to choose a previous series, always choose the last version out of the [[Samba_Release_Planning#Maintenance_Mode|Maintainance Mode series]] or at least from the [[Samba_Release_Planning#Security_Fixes_Only_Mode|Security Fixes Only Mode]]. Older version may not contain all improvements, bug- and security fixes. Also if you require help and ask e. g. on the [https://lists.samba.org/mailman/listinfo/samba Samba Mailing List], you typically will be told to try a recent version, to ensure that the problem isn't fixed in the meantime.
 +
 
 +
Further information about Samba Release Plannings and Supported Release Lifetime, you can find at the [[Samba_Release_Planning|Samba Release Planning]] page.
 +
 
 +
 
 +
 
 +
== Development versions ==
 +
 
 +
=== samba-master ===
 +
 
 +
'''Warning: Never install a development version in production! It may contain untested features and can cause damages to your installation! Development releases are for testing purposes only!'''
 +
 
 +
„samba-master“ contains the source of the [[Samba_Release_Planning#Upcoming_Release|upcomming release series]].
 +
 
 +
To download the latest samba-master repository, run
  
 
  $ git clone git://git.samba.org/samba.git samba-master
 
  $ git clone git://git.samba.org/samba.git samba-master
  
Alternatively, if you prefer to use the <tt>http</tt> protocol, run the following command:
+
alternatively:
  
 
  $ git clone http://gitweb.samba.org/samba.git samba-master
 
  $ git clone http://gitweb.samba.org/samba.git samba-master
  
Either command will create a directory called <tt>samba-master</tt> in the current
 
directory. This holds a checkout of the 'master' development branch.
 
  
 
  
'''If you are using the checkout for a production installation you should use the following git branches:'''
+
=== Development version of a specific branch ===
 +
 
 +
The v*-test branches contain the latest changes and patches since the last official release of that source tree.
  
* 'v4-0-stable' (which contains the latest stable 4.0.x release)
+
The following example demonstrate the checkout of the latest sources of Samba 4.1, scheduled for the next 4.1.x release:
  
    $ git clone -b v4-0-stable git://git.samba.org/samba.git samba-v4-0-stable
+
$ git clone -b v4-1-test git://git.samba.org/samba.git samba-v4-1-test
  
'''or'''
+
alternatively:
  
* 'v4-0-test' (which contains the patches scheduled for the next stable 4.0.x release)
+
$ git clone -b v4-1-test http://git.samba.org/samba.git samba-v4-1-test
  
    $ git clone -b v4-0-test git://git.samba.org/samba.git samba-v4-0-test
 
  
==== Updating via git ====
+
 +
=== Updating a local git repository ===
  
If you already have downloaded the source tree via <tt>git</tt> and want to update the tree to the latest version, run the following command in your <tt>samba-master</tt> directory:
+
If you already have downloaded a development source tree via „git“ and want to update it to the latest version, run the following command out of your corresponding git source directory:
  
 
  $ git pull
 
  $ git pull
  
If you get an error like this:
+
If you receive the following error
  fatal: Unable to create '[...]/samba_master/.git/index.lock': File exists.
+
 
Run the command below to reset your tree.
+
  fatal: Unable to create '[...]/.git/index.lock': File exists.
  
If you are having trouble compiling the source, it may be due to stale files.  You can reset your <tt>git</tt> tree to correct these errors.  To reset your <tt>git</tt> tree, run the following command in your <tt>samba-master</tt> directory:
+
run
  
 
  $ git clean -x -f -d
 
  $ git clean -x -f -d
  
== Step 2: Compile Samba ==
+
to reset your tree.
 +
 
 +
 
 +
 
 +
 
 +
 
 +
= Compile Samba =
  
To build Samba, run the following command in your <tt>samba-master</tt> directory:
+
To build Samba, run the following commands out of the root of your Samba source directory (Only for compiling a Samba 3.x version, run the commands in the subdirectory [...]/source3/):
  
  $ cd samba-master
+
   $ ./configure
   $ ./configure  
 
 
   $ make
 
   $ make
  
The above command will setup Samba to install in <tt>/usr/local/samba</tt>.  
+
The above command will setup Samba to install in /usr/local/samba/.
 +
 
 +
It's recommended to run
 +
 
 +
$ ./configure --help
 +
 
 +
to check out the possible configure options, to adapt your installation.
 +
 
 +
If you are using a development version of Samba or require a build with extra debug information, that may help to diagnose in case of failure, add the following option to „configure“:
 +
--enable-debug
  
* If you want Samba to install in a different directory, then you should use the <tt>--prefix</tt> option to <tt>configure</tt>.
+
To include the Samba selftest („make test“) in the build, add the following option to „configure“:
 +
--enable-selftest
  
* We recommend using <tt>--enable-debug --enable-selftest</tt> for Samba is that it will include extra debug information that will help us diagnose problems in case of failures, and will also allow you to run our selftest <tt>make test</tt> to validate that Samba can behave correctly on your platform.  Both of these are however, entirely '''optional'''.
 
  
== Step 3: Install Samba ==
 
  
To install Samba, run the following command in your <tt>samba-master</tt> directory:
 
  
  $ make install
 
  
Note that this must be run as a user who has permission to write to the install directory, which defaults to <tt>/usr/local/samba</tt>. See [[#Step 2: Compile Samba4|Step 2: Compile Samba ]] for instructions on how to change the install directory.
+
= Install Samba =
  
== Upgrading a source version ==
+
To install Samba, run the following command in your Samba source directory as user „root“ (Only for installing a Samba 3.x version, run the command in the subdirectory [...]/source3/):
  
To upgrade to the latest Samba version from a previous Samba release, you must first download the latest tarball, or use the git tree. If using git, you may either do a full download of the latest git tree as described in the [http://wiki.samba.org/index.php/Samba4/HOWTO#Downloading_via_git Downloading via git] section, or you may upgrade your current git tree as described in the [http://wiki.samba.org/index.php/Samba4/HOWTO#Updating_via_git Updating via git] section. Once you have obtained the latest version, simply run the following commands.
+
# make install
  
  $ cd samba-master
 
  $ ./configure
 
  $ make
 
  $ make install
 
  
* Note: Please use the same ./configure options as before to retain full functionality. The example above assumes that you source directory is named samba-master.
 
  
For more information on the commands above and their associated options, please refer to [http://wiki.samba.org/index.php/Samba4/HOWTO#Step_2:_Compile_Samba Step 2]
+
= Upgrading a source version =
  
If you are upgrading from a previous release of Samba 4.x, be sure to review all the release notes for the new version, as well as the notes for all the interim versions.
+
See [[Updating_Samba|Updating Samba]].

Revision as of 23:25, 27 May 2014

Introduction

This document describes how to build Samba from source.

It can be used for any kind of Samba installation (Samba AD DC, Member Server, Samba PDC, etc.).



Samba Operating System Requirements

See OS Requirements.



Obtaining Samba

Stable version (recommended)

You can download the latest version of Samba from https://www.samba.org/.

It is always recommended that you install the latest version of the current stable release. If you require to choose a previous series, always choose the last version out of the Maintainance Mode series or at least from the Security Fixes Only Mode. Older version may not contain all improvements, bug- and security fixes. Also if you require help and ask e. g. on the Samba Mailing List, you typically will be told to try a recent version, to ensure that the problem isn't fixed in the meantime.

Further information about Samba Release Plannings and Supported Release Lifetime, you can find at the Samba Release Planning page.


Development versions

samba-master

Warning: Never install a development version in production! It may contain untested features and can cause damages to your installation! Development releases are for testing purposes only!

„samba-master“ contains the source of the upcomming release series.

To download the latest samba-master repository, run

$ git clone git://git.samba.org/samba.git samba-master

alternatively:

$ git clone http://gitweb.samba.org/samba.git samba-master


Development version of a specific branch

The v*-test branches contain the latest changes and patches since the last official release of that source tree.

The following example demonstrate the checkout of the latest sources of Samba 4.1, scheduled for the next 4.1.x release:

$ git clone -b v4-1-test git://git.samba.org/samba.git samba-v4-1-test

alternatively:

$ git clone -b v4-1-test http://git.samba.org/samba.git samba-v4-1-test


Updating a local git repository

If you already have downloaded a development source tree via „git“ and want to update it to the latest version, run the following command out of your corresponding git source directory:

$ git pull

If you receive the following error

fatal: Unable to create '[...]/.git/index.lock': File exists.

run

$ git clean -x -f -d

to reset your tree.



Compile Samba

To build Samba, run the following commands out of the root of your Samba source directory (Only for compiling a Samba 3.x version, run the commands in the subdirectory [...]/source3/):

 $ ./configure
 $ make

The above command will setup Samba to install in /usr/local/samba/.

It's recommended to run

$ ./configure --help

to check out the possible configure options, to adapt your installation.

If you are using a development version of Samba or require a build with extra debug information, that may help to diagnose in case of failure, add the following option to „configure“:

--enable-debug 

To include the Samba selftest („make test“) in the build, add the following option to „configure“:

--enable-selftest



Install Samba

To install Samba, run the following command in your Samba source directory as user „root“ (Only for installing a Samba 3.x version, run the command in the subdirectory [...]/source3/):

# make install


Upgrading a source version

See Updating Samba.