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