2004-12-03 06:08:36 +03:00
Samba4 developer howto
2008-01-19 23:16:56 +03:00
======================
2004-12-03 06:08:36 +03:00
tridge@samba.org, December 2004
2007-01-08 20:28:14 +03:00
A more up to date version of this howto can be found in the wiki
at http://wiki.samba.org/index.php/Samba4/HOWTO.
2004-12-03 06:08:36 +03:00
This is a very basic document on how to setup a simple Samba4
server. This is aimed at developers who are already familiar with
Samba3 and wish to participate in Samba4 development. This is not
aimed at production use of Samba4.
2008-01-19 23:16:56 +03:00
.. contents::
2004-12-03 06:08:36 +03:00
Step 1: download Samba4
-----------------------
2008-03-29 07:18:25 +03:00
If you have downloaded the Samba4 code via a tarball released from the
samba.org website, Step 1 has already been completed for you. For testing
with the version released in the tarball, you may continue on to Step 2. Note
that the references below to the top-level directory named "samba4" will
instead be based on the name of the tarball downloaded (e.g.
"samba-4.0.0alpha3" for the tarball samba-4.0.0alpha3.tar.gz).
2004-12-03 06:08:36 +03:00
There are 2 methods of doing this:
2008-01-19 23:16:56 +03:00
method 1: "rsync -avz samba.org::ftp/unpacked/samba_4_0_test/ samba4"
2004-12-03 06:08:36 +03:00
2008-05-08 21:57:29 +04:00
method 2: "git clone git://git.samba.org/samba.git samba4; cd samba4 && git checkout -b v4-0-test origin/v4-0-test; cd .."
2004-12-03 06:08:36 +03:00
both methods will create a directory called "samba4" in the current
2008-01-19 23:16:56 +03:00
directory. If you don't have rsync or git then install one of them.
2004-12-03 06:08:36 +03:00
2006-01-24 04:52:42 +03:00
Since only released versions of Samba contain a pregenerated configure script,
2008-01-19 23:16:56 +03:00
you will have to generate it by hand::
2006-01-24 04:52:42 +03:00
$ cd samba4/source
$ ./autogen.sh
2008-01-19 23:16:56 +03:00
Note that the above rsync command will give you a checked out git
repository. So if you also have git you can update it to the latest
version at some future date using::
2004-12-03 06:08:36 +03:00
2005-04-17 04:45:49 +04:00
$ cd samba4
2008-01-19 23:16:56 +03:00
$ git pull origin v4-0-test
2004-12-03 06:08:36 +03:00
Step 2: compile Samba4
----------------------
2006-01-27 21:16:53 +03:00
Recommended optional development libraries:
- acl and xattr development libraries
- gnutls
- readline
2008-01-19 23:16:56 +03:00
Run this::
2004-12-03 06:08:36 +03:00
2005-04-17 04:45:49 +04:00
$ cd samba4/source
2006-01-24 04:52:42 +03:00
$ ./configure
2008-03-29 08:07:32 +03:00
$ make
2004-12-03 06:08:36 +03:00
Step 3: install Samba4
----------------------
Run this as a user who have permission to write to the install
directory (defaults to /usr/local/samba). Use --prefix option to
configure above to change this.
2008-01-19 23:16:56 +03:00
::
2004-12-03 06:08:36 +03:00
2005-04-17 04:45:49 +04:00
# make install
2004-12-03 06:08:36 +03:00
Step 4: provision Samba4
------------------------
2008-02-26 08:24:09 +03:00
The "provision" step sets up a basic user database.
2005-09-14 02:58:38 +04:00
Must be run as a user with permission to write to the install directory.
2004-12-03 06:08:36 +03:00
2008-01-19 23:16:56 +03:00
::
2005-09-14 02:58:38 +04:00
# cd source
2008-05-24 17:48:05 +04:00
# ./setup/provision --realm=YOUR.REALM --domain=YOURDOM \
2007-09-22 16:57:50 +04:00
# --adminpass=SOMEPASSWORD --server-role='domain controller'
2004-12-03 06:08:36 +03:00
2006-01-24 03:09:41 +03:00
'YOURDOM' is the NT4 style domain name. 'YOUR.REALM' is your kerberos
realm, which is typically your DNS domain name.
2004-12-03 06:08:36 +03:00
Step 5: Create a simple smb.conf
--------------------------------
2005-07-20 15:15:52 +04:00
The provisioning will create a very simple smb.conf with no shares by
default. You will need to update it to add at least one share. For
2008-01-19 23:16:56 +03:00
example::
2004-12-03 06:08:36 +03:00
[test]
path = /data/test
read only = no
Step 6: starting Samba4
-----------------------
2009-10-17 13:10:03 +04:00
The simplest is to just run "samba", but as a developer you may find
2008-01-19 23:16:56 +03:00
the following more useful::
2004-12-03 06:08:36 +03:00
2009-10-17 13:10:03 +04:00
# samba -i -M single
2004-12-03 06:08:36 +03:00
2009-10-17 13:10:03 +04:00
that means "start samba without messages in stdout, and running a
single process. That mode of operation makes debugging samba with gdb
2005-07-20 15:15:52 +04:00
particularly easy.
2004-12-03 06:08:36 +03:00
2005-04-17 04:45:49 +04:00
Note that now it is no longer necessary to have an instance of nmbd
from Samba 3 running. If you are running any smbd or nmbd processes
2009-10-17 13:10:03 +04:00
they need to be stopped before starting samba from Samba 4.
2005-04-17 04:45:49 +04:00
2004-12-03 06:08:36 +03:00
Make sure you put the bin and sbin directories from your new install
in your $PATH. Make sure you run the right version!
Step 7: testing Samba4
----------------------
2008-03-29 08:07:32 +03:00
try this command::
2004-12-03 06:08:36 +03:00
2008-01-19 23:16:56 +03:00
$ smbclient //localhost/test -Uadministrator%SOMEPASSWORD
2004-12-19 03:52:08 +03:00
NOTE about filesystem support
-----------------------------
To use the advanced features of Samba4 you need a filesystem that
supports both the "user" and "system" xattr namespaces.
If you run Linux with a 2.6 kernel and ext3 this means you need to
2008-01-19 23:16:56 +03:00
include the option "user_xattr" in your /etc/fstab. For example::
2004-12-19 03:52:08 +03:00
2008-01-19 23:16:56 +03:00
/dev/hda3 /home ext3 user_xattr 1 1
2004-12-19 03:52:08 +03:00
You also need to compile your kernel with the XATTR and SECURITY
2008-01-19 23:16:56 +03:00
options for your filesystem. For ext3 that means you need::
2004-12-19 03:52:08 +03:00
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_SECURITY=y
2004-12-03 06:08:36 +03:00
2005-04-17 04:45:49 +04:00
If you are running a Linux 2.6 kernel with CONFIG_IKCONFIG_PROC
2008-01-19 23:16:56 +03:00
defined you can check this with the following command::
2005-04-17 04:45:49 +04:00
$ zgrep CONFIG_EXT3_FS /proc/config.gz
2004-12-17 09:32:04 +03:00
If you don't have a filesystem with xattr support, then you can
2008-01-19 23:16:56 +03:00
simulate it by using the option::
2004-12-03 06:08:36 +03:00
2004-12-17 09:32:04 +03:00
posix:eadb = /usr/local/samba/eadb.tdb
that will place all extra file attributes (NT ACLs, DOS EAs, streams
etc), in that tdb. It is not efficient, and doesn't scale well, but at
least it gives you a choice when you don't have a modern filesystem.
2005-01-03 05:26:14 +03:00
Testing your filesystem
-----------------------
To test your filesystem support, install the 'attr' package and run
2008-01-19 23:16:56 +03:00
the following 4 commands as root::
2005-01-03 05:26:14 +03:00
2005-04-17 04:45:49 +04:00
# touch test.txt
# setfattr -n user.test -v test test.txt
# setfattr -n security.test -v test2 test.txt
# getfattr -d test.txt
# getfattr -n security.test -d test.txt
2005-01-03 05:26:14 +03:00
2008-01-19 23:16:56 +03:00
You should see output like this::
2005-01-03 05:26:14 +03:00
# file: test.txt
user.test="test"
2008-01-19 23:16:56 +03:00
2005-01-03 05:26:14 +03:00
# file: test.txt
security.test="test2"
If you get any "Operation not supported" errors then it means your
kernel is not configured correctly, or your filesystem is not mounted
with the right options.
If you get any "Operation not permitted" errors then it probably means
you didn't try the test as root.
2005-06-01 05:29:36 +04:00
2008-01-19 23:16:56 +03:00
..
vim: ft=rest