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