2.1. Binary Packages
Samba is so popular with Unix/Linux administrators that many vendors include prepackaged versions in their operating system distributions. There are advantages to using software packages, one of which is that you do not have to bother with the details of compiling the software itself. The main drawback is that you are dependent on the options the vendor chose when building Samba. It is also likely that the server will be slightly behind the current production Samba release, because vendors tend to upgrade packages only when there is a strong reason, such as a widely experienced bug or security issue. On the other hand, you can be fairly sure that a bundled version has been installed properly, and perhaps it will take only a few simple modifications to your smb.conf file for you to be up and running. Samba is mature enough that you probably don't need the latest release to meet your basic needs, so you might be perfectly happy running a bundled version.
If you choose this option, be aware that your Samba files, including the very important smb.conf, will likely be stored somewhere other than the default locations used by Samba when it has been built from source. For example, with most Linux distributions, smb.conf and some other Samba-related files are in the /etc/samba directory. The default location when building from source is /usr/local/samba/lib.
If Samba is already installed on your system, you can check which version you have by using the command:
$ smbd -V Version 3.0.12
If you receive a message back similar to "command not found," either Samba is not installed or smbd is not in your shell's search path. In the latter case, use the find command to locate the smbd executable.
$ find / -name smbd -print /opt/samba/sbin/smbd
You might also be able to use a system-specific tool to query a software-package maintenance utility for the location of the Samba programs. On RPM-based systems such as Red Hat Enterprise Linux and Novell's SUSE Linux, you can use the rpm command to query the installed packages for Samba. In this example, Samba has been split between multiple packages.
$ rpm -qa | grep samba samba-3.0.12-5 samba-client-3.0.12-5 samba-common-3.0.12-5
Other platforms will most likely have similar toolsets for querying installed software packages. For example, Solaris includes the pkginfo application and Debian Linux provides dpkg . If you are unsure which tools are available, check your server's operating system documentation.
It is possible to determine certain information about Samba's build using the -b option. This option instructs smbd to print its list of compile-time values for items such as directory search paths. The -b option can produce several screens of data. So unless you can read extremely fast, it is best to pipe the output to a file, page through it with a pager utility such as less or more, or simply grep the information you need. The following example shows that smbd expects its configuration file to be found in the /etc/samba directory.
$ smbd -b | grep CONFIGFILE CONFIGFILE: /etc/samba/smb.conf
Even if a vendor does not include Samba with the operating system, precompiled binary packages are available for a large number of platforms. These packages are often maintained by members of the Samba community for the purpose of saving you a fair amount of time and trouble. The best place to begin when looking for installable Samba packages is http://www.samba.org/samba/ftp/Binary_Packages. Here you will find either the packages themselves or links to sites that do provide them.
When using a package from a third party, it is vital to ensure that the correct libraries required by the executables are also installed. If your system does not already have the required version of a library, you might have to install a new version.
Package managers such as RPM provide dependencies checks to ensure that all of the necessary libraries for a piece of software are available before the software can be installed. If your software packaging system does not support this feature, many systems with shared libraries do come with a tool called ldd. This tool tells you which libraries a specific binary requires and which libraries on the system satisfy that requirement. For example, checking the smbd program on our test machine gave us:
$ ldd /usr/local/samba/sbin/smbd linux-gate.so.1 => (0xffffe000) libldap-2.2.so.7 => /usr/lib/libldap-2.2.so.7 (0x40019000) liblber-2.2.so.7 => /usr/lib/liblber-2.2.so.7 (0x4004b000) libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x40058000) libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x4006f000) libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x400e2000) libcom_err.so.2 => /lib/libcom_err.so.2 (0x40120000) libcups.so.2 => /usr/lib/libcups.so.2 (0x40124000) libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x40141000) libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x40171000) libnsl.so.1 => /lib/libnsl.so.1 (0x40264000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x40279000) libpam.so.0 => /lib/libpam.so.0 (0x402ab000) libresolv.so.2 => /lib/libresolv.so.2 (0x402b4000) libdl.so.2 => /lib/libdl.so.2 (0x402c7000) libpopt.so.0 => not found libc.so.6 => /lib/tls/libc.so.6 (0x402d3000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x403ec000) libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x40401000) /lib/ld-linux.so.2 (0x40000000)
If there are any incompatible (or missing) libraries at this stage, the distribution-specific documentation should highlight them. In this example, the popt library cannot be found. This type of problem usually occurs for one of two reasons: either the library is not present on the system or the library is present but is stored in a location outside the runtime library search path. The solution to the first problem is simple: install the missing library. The solution to the second issue is platform- dependent. For example, on Linux, you can edit /etc/ld.so.conf to add directories to the search path for the run time linker, and on Solaris, you can use the crle tool to perform a similar function.