2009
12.01

Download the source and unpack…

# wget http://samba.org/samba/ftp/stable/samba-3.4.3.tar.gz
# tar zxvf samba-3.4.3.tar.gz
# cd samba-3.4.3/source3

Some people have tried the latest Samba 3.4.4 and report that it works with the rest of these instructions as well. If you want 3.4.4, do this instead:
# wget http://samba.org/samba/ftp/stable/samba-3.4.4.tar.gz
# tar zxvf samba-3.4.4.tar.gz
# cd samba-3.4.4/source3

I needed some development headers for the compile, so

# apt-get install libldap2-dev libkrb5-dev uuid-dev libpam0g-dev zlib1g-dev

You may need more than these – if so, your configure will fail and it will tell you that something.h wasn’t found. apt-cache search something will usually give you the package you are looking for, or a quick Google will tell you what to get.  For example, I was told uuid.h was missing, so:

# apt-cache search uuid | grep -- -dev
libblkid-dev - block device id library - headers and static libraries
libossp-uuid-dev - OSSP uuid ISO-C and C++ - headers and static libraries
uuid-dev - universally unique id library - headers and static libraries

uuid-dev was pretty obvious, so I installed it and the next time I ran ./configure, it went further before failing on something else.  The apt-get command above includes all of the roadblocks I ran into.

Here is the ./configure command I used, which matches the one from the Ubuntu 3.0.28a source with the exception that I removed –without-smbclient from the list of options.

You may want to use Yogg’s configure command from the comments below instead – I haven’t tried it yet, but he indicates it matches the actual Ubuntu file structure better.

# ./configure --cache-file=./config.cache \
--with-fhs \
--enable-shared \
--enable-static \
--disable-pie \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/etc/samba \
--with-privatedir=/etc/samba \
--with-piddir=/var/run/samba \
--localstatedir=/var \
--with-rootsbindir=/sbin \
--with-pammodulesdir=/lib/security \
--with-pam \
--with-syslog \
--with-utmp \
--with-readline \
--with-pam_smbpass \
--with-libsmbclient \
--with-winbind \
--with-shared-modules=idmap_rid,idmap_ad \
--with-automount \
--with-ldap \
--with-ads \
--with-dnsupdate \
--with-cifsmount \
--with-acl-support \
--with-quotas

Once the ./configure ran without issues, I ran make:
# make
Using CFLAGS = -O -I. -I/root/samba-3.4.3/source3 -I/root/samba-3.4.3/source3/../lib/popt -I/root/samba-3.4.3/source3/iniparser/src -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/talloc -I./../lib/tevent -I./../lib/tdb/include -I./libaddns -I./librpc -I./.. -DHAVE_CONFIG_H -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/talloc -I./../lib/tevent -I./../lib/tdb/include -I./libaddns -I./librpc -I./.. -I./../lib/popt -DLDAP_DEPRECATED -I/root/samba-3.4.3/source3/lib -I.. -I../source4 -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3
PICFLAG = -fPIC
LIBS = -lresolv -lnsl -ldl
LDFLAGS = -Wl,-z,relro -Wl,-Bsymbolic-functions -L./bin
DYNEXP = -Wl,--export-dynamic
LDSHFLAGS = -shared -Wl,-Bsymbolic -Wl,-z,relro -Wl,-Bsymbolic-functions -L./bin
SHLIBEXT = so
SONAMEFLAG = -Wl,-soname=
mkdir bin
Compiling ../lib/talloc/talloc.c
Linking non-shared library bin/libtalloc.a
Compiling ../lib/replace/replace.c
Compiling ../lib/replace/snprintf.c
Compiling ../lib/replace/getpass.c
creating /root/samba-3.4.3/source3/exports/libtalloc.syms
Linking shared library bin/libtalloc.so.1
Compiling ../lib/tdb/common/tdb.c
Compiling ../lib/tdb/common/dump.c
... etc ...

which went fine, then make install:
# make install
Using CFLAGS = -O -I. -I/root/samba-3.4.3/source3 -I/root/samba-3.4.3/source3/../lib/popt -I/root/samba-3.4.3/source3/iniparser/src -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/talloc -I./../lib/tevent -I./../lib/tdb/include -I./libaddns -I./librpc -I./.. -DHAVE_CONFIG_H -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/talloc -I./../lib/tevent -I./../lib/tdb/include -I./libaddns -I./librpc -I./.. -I./../lib/popt -DLDAP_DEPRECATED -I/root/samba-3.4.3/source3/lib -I.. -I../source4 -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3
PICFLAG = -fPIC
LIBS = -lresolv -lnsl -ldl
LDFLAGS = -Wl,-z,relro -Wl,-Bsymbolic-functions -L./bin
DYNEXP = -Wl,--export-dynamic
LDSHFLAGS = -shared -Wl,-Bsymbolic -Wl,-z,relro -Wl,-Bsymbolic-functions -L./bin
SHLIBEXT = so
SONAMEFLAG = -Wl,-soname=
Installing bin/smbd as ///usr/sbin/smbd
Installing bin/nmbd as ///usr/sbin/nmbd
Installing bin/swat as ///usr/sbin/swat
Installing bin/winbindd as ///usr/sbin/winbindd
======================================================================
The binaries are installed. You may restore the old binaries (if there
were any) using the command "make revert". You may uninstall the binaries
using the command "make uninstallbin" or "make uninstall" to uninstall
binaries, man pages and shell scripts.
======================================================================
Installing bin/wbinfo as ///usr/bin/wbinfo
Installing bin/smbclient as ///usr/bin/smbclient
Installing bin/net as ///usr/bin/net
... etc ...

which, since I used the configure flags from the original Ubuntu distro, just installs the new version over top of the old.

Next, I tried restarting samba, but I got an error about a missing library:

# /etc/init.d/samba restart
* Stopping Samba daemons [ OK ]
* Starting Samba daemons
/usr/sbin/nmbd: error while loading shared libraries: libtalloc.so.1: cannot open shared object file: No such file or directory
[fail]

You need to tell your system where to find the libraries it’s looking for. Stupid system. We just made them, but it doesn’t know where to find them. Create /etc/ld.so.conf.d/samba.conf as follows:

# echo "/etc/samba" > /etc/ld.so.conf.d/samba.conf
# ldconfig

Then you should be able to start Samba.

# /etc/init.d/samba start
* Starting Samba daemons [ OK ]

Don’t forget to copy the new samba.schema into the LDAP schema directory if you’re using LDAP.
# cp ../../examples/LDAP/samba.schema /etc/ldap/schema/samba.schema

  • Delicious
  • Digg
  • WordPress
  • Twitter
  • Facebook
  • Yahoo Bookmarks
  • Windows Live Spaces
  • Blogger Post
  • Google Reader
  • Share/Bookmark

28 comments so far

Add Your Comment
  1. Ok, I’ve upgraded samba from 3.0.28a to 3.4.4 by these instructions. It all went without any errors. But when I look up which version is on ubuntu hardy, it gives me 3.0.28a. What can I do? Thx for reply

    • Package management apps like apt, aptitude, dpkg won’t know about the version you just compiled and installed. If you did everything correctly and the ‘make install’ worked, then you are running the new version.

      Running ‘smbstatus’ at the command line will tell you the version that’s actually installed.

  2. OK, I followed this to the letter but when I get to the make section I get “make: *** No targets specified and no makefile found. Stop.” To my knowledge the configure section was successful. I received no errors during configuration at least not that I saw. I googled this error and it means the make file is missing. When I run the DIR command there is no make file listed. Any assistance is appreciated. This is litterally my first time ever compiling a program from source.

    • Are you in the source3 directory? Can you post the output of your ‘./configure’, and a ‘pwd’, and ‘ls -al’?

      Which source package are you using? 3.4.3 or something newer?

  3. Did anyone get ACL working with samba after the upgrade? I can log into the domain with Windows 7, however ACL permissions are not being translated through to windows. I checked they’re working on the server. Googling was no help here.

    • I’m using Samba 3.5.2

  4. Hi there!
    Decided to upgrade my samba servers (DC (32bit) and File Server (64bit)) using this manual.
    ./configure with all includes goes well on DC. Creates makefile etc., but on File Server ./configure makes only makefile-noincludes file.
    Is there any difference between includes for 32bit and 64bit machines?

    • I fixed it – needed to install build-essentials package ;)

  5. The guide also works fine for samba 3.5.1

  6. –libdir=/etc/samba
    Is this right?

    –with-privatedir=/etc/samba
    The same thing ^^

    Where have you the “./configure command” from?

    • The configure flags are from the Ubuntu 8.04 samba sources:

      # cd ~/
      # apt-get source samba
      # cat ~/samba-3.0.28a/debian/rules | less

      (I don’t have an Ubuntu system here to double-check, but the apt-get command above will put the sources in your home directory, and I’m assuming the directory name will be samba-3.0.28a. Adjust accordingly.)

      I suppose that doesn’t necessarily mean that the binary .deb that one would normally download to install samba has the same configure flags – I just posted what I used and this is how I found them…

      • I have now tested some options.

        This one seems to be the cleaner way. All libs are on the right place. And everything else also. If i have overseen something please correct me.

        ./configure –cache-file=./config.cache \
        –prefix=/usr \
        –sysconfdir=/etc \
        –localstatedir=/var \
        –with-privatedir=/etc/samba \
        –with-piddir=/var/run/samba \
        –with-fhs \
        –enable-shared \
        –enable-static \
        –disable-pie \
        –with-rootsbindir=/sbin \
        –with-pammodulesdir=/lib/security \
        –with-pam \
        –with-syslog \
        –with-utmp \
        –with-readline \
        –with-pam_smbpass \
        –with-libsmbclient \
        –with-winbind \
        –with-shared-modules=idmap_rid,idmap_ad \
        –with-automount \
        –with-ldap \
        –with-ads \
        –with-dnsupdate \
        –with-cifsmount \
        –with-acl-support \
        –with-quotas

        With this options also
        # echo “/etc/samba” > /etc/ld.so.conf.d/samba.conf
        # ldconfig
        is not necessary any more.

        The upgrade instructions work for 3.4.3, 3.4.4 and 3.4.5 (Maybe also for future versions ;) )

        If someone use Samba with LDAP maybe you need “ldap ssl = No” in the smb.conf.

        If Winbindd uses 100% cpu time set “winbind cache time = xx” to a minimum of 1 in the smb.conf (15 is default [seconds]).

        • I have forget to add
          –enable-cups
          Else there is no printer support

          To add Windows7 machines to samba this Link is useful :)
          http://wiki.samba.org/index.php/Windows7

          • Yes, unfortunately you still have to tweak the registry in Windows 7 for it to work – this just takes care of the samba upgrade. Thanks for the link.

  7. Thanks for the fantastic post! Worked step by step with no faults.

  8. Anyone know if this method works for installing Samba 3.4.3 fresh or does Samba 3.0.28a need to be installed previously?

    I’m trying to adapt this guide to another guide here: http://ubuntuforums.org/showthread.php?t=640760

    The end result should be a Samba+LDAP server using 8.04 LTS that is also compatible with Windows 7 clients.

  9. Further update: IT WORKS!

    Am back on 3.3.4. I needed to edit my smb.conf file to stop TLS errors in LDAP:

    ldap ssl = No

    Happy man. Thanks very much for this very useful guide.

    c:)

  10. I followed your excellent directions on two identical 9.10 machines (the 3.4.0 Samba on 9.10 seems to be broken). Both ran through with no errors. The odd thing is, 3.4.3 works beautifully on one, and on the other one fails with

    server:~$ smbclient //192.168.X.X/user
    Enter users’s password:
    Receiving SMB: Server stopped responding
    session setup failed: Call returned zero bytes (EOF)

    which is bizarre!

  11. Update,

    Ok, I’ve upgraded and then downgraded back to 3.0.28a.

    I needed to do “sudo smbpasswd -w [LDAP_ADMIN_PASSWORD]” to get LDAP working again.

    Windows 7 machines now connect to the domain but then fail on reboot when trying to log in with “Trust Relationship Between Workstation and Domain Fails”.

    Isn’t this fun?

    c:)

    • I’ve seen quite a few posts about this, but I haven’t gotten to testing Windows 7 just yet. I imagine it will break for me too, just like everything else does. :D

      Who said linux was easy?

    • Did you resolv the problem?

  12. I have used this to upgrade to Samba 3.3.4 as I have read that this works better with Windows 7, but have run into diffculties. The install seemed to go fine, but I’m getting:

    [2009/12/07 22:37:48, 0] lib/smbldap.c:smb_ldap_start_tls(600)
    Failed to issue the StartTLS instruction: Protocol error

    These errors. My LDAP directory seems to be intact, but I can’t join any machines to the Domain or log on.

    Any ideas?

    c:)

    • Is anything else able to talk to LDAP using TLS? Can you get Samba working without TLS first? I would start from the basics and make sure everything is working, then add TLS if necessary. (If LDAP and Samba are on the same server, then it’s probably not necessary anyways – just do everything over 127.0.0.1 and block the LAN/WAN…)

  13. An excellent article!
    Thanks a lot for posting. Just one comment based on what I ran into, which is that a C-compiler is needed (e.g., gcc). It’s obvious now, but I did not have one installed on my fileserver.

    Thanks again as it was very helpful.

    • Indeed, gcc should really be a “standard” part of a linux install – I run into the need to compile from source all the time… (linux is definitely a double-edged sword in that respect)

  14. Congratulations for this post.

    I used this guide on Kubuntu 9.10 64 bits and it worked perfectly.

  15. Hi. I downloaded the source tar file, but it turned that in ./samba-3.4.3 directory, there is no configure script

    Instead there are 2 directories:
    ./samba-3.4.3/source3
    ./samba-3.4.3/source4

    in the ./samba-3.4.3 directory there is a file named: “howto4.txt”
    In this file there is a description on how to compile, with apears to be wrong also

    cant use autoconf.sh in the source4 directory.
    instead in the source3. Witch of course gives and error message with missing packages:
    :~/samba-3.4.3/source3$ ./autogen.sh
    ./autogen.sh: need autoconf 2.53 or later to build samba from GIT

    …. can someone try this approach ?

    I’m not in the mood to brake my server :D
    And don’t have a spare, to experiment on.

    • Oops, my mistake. I was indeed in the source3 directory. I’ve updated the post to reflect that…