r20689: "pdc" and "bdc" have been replaced by "domain controller"
[ira/wip.git] / howto.txt
1 Samba4 developer howto
2 ----------------------
3
4 tridge@samba.org, December 2004
5
6
7 A more up to date version of this howto can be found in the wiki 
8 at http://wiki.samba.org/index.php/Samba4/HOWTO.
9
10 This is a very basic document on how to setup a simple Samba4
11 server. This is aimed at developers who are already familiar with
12 Samba3 and wish to participate in Samba4 development. This is not
13 aimed at production use of Samba4.
14
15
16 Step 1: download Samba4
17 -----------------------
18
19 There are 2 methods of doing this:
20
21   method 1:  "rsync -avz samba.org::ftp/unpacked/samba4 ."
22
23   method 2:  "svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0 samba4"
24
25 both methods will create a directory called "samba4" in the current
26 directory. If you don't have rsync or svn then install one of them. 
27
28 Since only released versions of Samba contain a pregenerated configure script, 
29 you will have to generate it by hand:
30
31  $ cd samba4/source
32  $ ./autogen.sh
33
34 Note that the above rsync command will give you a checked out svn
35 repository. So if you also have svn you can update it to the latest
36 version at some future date using:
37
38   $ cd samba4
39   $ svn up
40
41 Step 2: compile Samba4
42 ----------------------
43
44 Recommended optional development libraries:
45 - acl and xattr development libraries
46 - gnutls
47 - readline
48
49 Run this:
50
51   $ cd samba4/source
52   $ ./configure
53   $ make proto all
54
55 If you have gcc 3.4 or newer, then substitute "pch" for "proto" to
56 greatly speed up the compile process (about 5x faster).
57
58 Step 3: install Samba4
59 ----------------------
60
61 Run this as a user who have permission to write to the install
62 directory (defaults to /usr/local/samba). Use --prefix option to
63 configure above to change this.
64  
65   # make install
66
67
68 Step 4: provision Samba4
69 ------------------------
70
71 The "provision" step sets up a basic user database. Make sure your smbscript
72 binary is installed in a directory listed in your PATH environment variable.
73 It is presumed it's available just like any other commands from your shell.
74 Must be run as a user with permission to write to the install directory.
75
76   # cd source
77   # ./setup/provision --realm=YOUR.REALM --domain=YOURDOM --adminpass=SOMEPASSWORD
78
79 REMINDER: Add the "bin" directory of the path you installed to
80           (e.g. /usr/local/samba/bin) to your path, or the provision command
81           will not work.
82
83 'YOURDOM' is the NT4 style domain name. 'YOUR.REALM' is your kerberos
84 realm, which is typically your DNS domain name.
85
86 Step 5: Create a simple smb.conf
87 --------------------------------
88
89 The provisioning will create a very simple smb.conf with no shares by
90 default. You will need to update it to add at least one share. For
91 example:
92
93   [test]
94         path = /data/test
95         read only = no
96
97
98 Step 6: starting Samba4
99 -----------------------
100
101 The simplest is to just run "smbd", but as a developer you may find
102 the following more useful:
103
104    # smbd -i -M single
105
106 that means "start smbd without messages in stdout, and running a
107 single process. That mode of operation makes debugging smbd with gdb
108 particularly easy.
109
110 Note that now it is no longer necessary to have an instance of nmbd
111 from Samba 3 running.  If you are running any smbd or nmbd processes
112 they need to be stopped before starting smbd from Samba 4.
113
114 Make sure you put the bin and sbin directories from your new install
115 in your $PATH. Make sure you run the right version!
116
117
118 Step 7: testing Samba4
119 ----------------------
120
121 try these commands:
122
123      $ smbclient //localhost/test -Uadministrator%SOMEPASSWORD
124     or
125      $ ./script/tests/test_posix.sh //localhost/test administrator SOMEPASSWORD
126
127
128 NOTE about filesystem support
129 -----------------------------
130
131 To use the advanced features of Samba4 you need a filesystem that
132 supports both the "user" and "system" xattr namespaces.
133
134 If you run Linux with a 2.6 kernel and ext3 this means you need to
135 include the option "user_xattr" in your /etc/fstab. For example:
136
137 /dev/hda3               /home                   ext3    user_xattr     1 1
138
139 You also need to compile your kernel with the XATTR and SECURITY
140 options for your filesystem. For ext3 that means you need:
141
142    CONFIG_EXT3_FS_XATTR=y
143    CONFIG_EXT3_FS_SECURITY=y
144
145 If you are running a Linux 2.6 kernel with CONFIG_IKCONFIG_PROC
146 defined you can check this with the following command:
147
148    $ zgrep CONFIG_EXT3_FS /proc/config.gz
149
150 If you don't have a filesystem with xattr support, then you can
151 simulate it by using the option:
152
153    posix:eadb = /usr/local/samba/eadb.tdb
154
155 that will place all extra file attributes (NT ACLs, DOS EAs, streams
156 etc), in that tdb. It is not efficient, and doesn't scale well, but at
157 least it gives you a choice when you don't have a modern filesystem.
158
159 Testing your filesystem
160 -----------------------
161
162 To test your filesystem support, install the 'attr' package and run
163 the following 4 commands as root:
164
165   # touch test.txt
166   # setfattr -n user.test -v test test.txt
167   # setfattr -n security.test -v test2 test.txt
168   # getfattr -d test.txt
169   # getfattr -n security.test -d test.txt
170
171 You should see output like this:
172
173   # file: test.txt
174   user.test="test"
175
176   # file: test.txt
177   security.test="test2"
178
179 If you get any "Operation not supported" errors then it means your
180 kernel is not configured correctly, or your filesystem is not mounted
181 with the right options.
182
183 If you get any "Operation not permitted" errors then it probably means
184 you didn't try the test as root.
185
186