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