Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition

2.3. Compiling and Installing Samba

At this point you should be ready to build the Samba executables. Compiling is even easier than configuration: in the source directory, type make on the command line. The make utility will produce a stream of explanatory and success messages, beginning with:

Using FLAGS = -O -Iinclude ...

This build includes all the mentioned Samba client and server binaries. If you encounter a problem when compiling, first check the Samba documentation to see whether it is easily fixable. Another possibility is to search or post to the Samba mailing lists, links to which are given at the end of Chapter 12 and on the Samba home page. Most compilation issues are system-specific and almost always easy to overcome.

Now that the files have been compiled, you can install them in the directories you identified. Make sure to change to the root user before running the following command:

$ make install

If you configured Samba to use the default locations for files, the new files will be installed in the directories listed in Table 2-2.

Table 2-2. Samba installation directories

Directory

Description

/usr/local/samba

Main tree

/usr/local/samba/bin

Client binaries and administartive tools

/usr/local/samba/sbin

Server binaries

/usr/local/samba/lib

smb.conf, lmhosts, configuration files, and so on

/usr/local/samba/man

Samba documentation

/usr/local/samba/private

Samba-encrypted password file

/usr/local/samba/swat

SWAT files

/usr/local/samba/var

Samba logfiles, lock files, tdb files, browse list info, shared memory files, process ID files

The remainder of the book assumes a default install location of /usr/local/samba. Beware that this can vary from system to system. Many vendors install Samba either to /opt or to /usr by default. If you are using a prepackaged version of Samba or have inherited a Samba server from a past administrator, be sure that you find out where the various tools, daemons, and configuration data were installed.

If you happen to be upgrading into the same directory tree as a previous Samba installation, the preexisting client tools and server binaries are saved with the extension .old, and you can go back to that previous version with the command make revert. After issuing make install, you should copy the .old files (if they exist) to a new location or name. Otherwise, the next time you install Samba (or even run make install a second time), the original .old will be overwritten without warning and you could lose your earlier version.

Congratulations! You now have Samba on your system!

2.3.1. Upgrading Your Installation

Eventually a new version of Samba will be released, and you will want to upgrade. Just repeat the same steps you used to install your current version. Download the source distribution from the Samba web site, unpack it, and then run the ./configure, make, and make install commands as before. If you've forgotten which options you used with the configure script, either take a look at the source/config.status file in your previous version's source distribution or examine the output of smbd -b to determine which features and directories were used. The config.status file is similar to a cache file. Its first few lines will show the options used the last time configure was run.

When upgrading, it is a good idea to back up a few important files in case something goes wrong. Samba developers support upgrades of Samba databases from one version to the next. However, downgrading is not supported. So keep a copy of the files listed in Table 2-3.[*]

[*] The list of tdb files might change in future releases, so be sure to check the WHATSNEW.txt file for updates.

Table 2-3. Important Samba configuration files

Filename

Description

${configdir}/smb.conf

Main configuration file.

${privatedir}/*

This directory contains sensitive data about such things as user passwords and important state information, such as the local machine security identifier (SID).

${lockdir}/nt*tdb

These database files contain information about printers, queues, and installed print drivers on the system.

${lockdir}/share_info.tdb

Contains the security descriptors assigned to file shares.

${lockdir}/group_mapping.tdb

Contains the table of Windows groups SID to Unix group IDs.

${lockdir}/account_policy.tdb

Local account policy data, such as password expiration time and account lockout settings.

${lockdir}/winbindd_idmap.tdb

Maintains the mappings between Windows users and groups and the allocated Unix uids and gids. Important only if you are running the winbindd daemon.

Table 2-4 gives a brief description of the remaining tdb files. These files either maintain runtime state information, and are therefore recreated by the Samba daemons on startup, or store cache information that can be rebuilt as necessary.

Table 2-4. Samba's volatile tdb and datafiles

Filename

Description

${lockdir}/brlock.tdb

Maintains information about open byte range file locks.

${lockdir}/locking.tdb

Contains data about open files, granted oplocks, and share mode entries on files.

${lockdir}/deferred_open.tdb

Maintains data necessary to implement Samba deferred file open semantics in conjunction with file locks.

${lockdir}/sessionid.tdb

Stores the list of active CIFS session UIDs.

${lockdir}/connections.tdb

Information regarding open share connections.

${lockdir}/printing/*tdb

Caches the queue listing of each available printer in smb.conf.

${lockdir}/permon/*tdb

Performance counters (if configured) to be returned to clients querying the HKPD registry hive.

${lockdir}/eventlog/*tdb

Eventlogs (if configured).

${lockdir}/gencache.tdb

Generic caching database used for such things as failed name resolution.

${lockdir}/login_cache.tdb

Cache of the failed login attempts used to enforce the password lockout policy setting.

${lockdir}/netsamlogon_cache.tdb

Cache of user and group information obtained in replies from domain controllers when authenticating via NTLM.

${lockdir}/registry.tdb

Implementation of the Windows registry for Samba servers. Currently, the file is rebuilt at startup and contains no sensitive or critical data.

${lockdir}/unexpected.tdb

List of unhandled packets returned from Windows clients on port 137 or 138.

${lockdir}/winbindd_cache.tdb

Cache file used by the winbindd daemon to improve performance when handling requests such as enumerating domain users and groups and mapping names to Windows sids.

${lockdir}/browse.dat

State information maintained by nmbd in relation to network browsing elections.

${lockdir}/wins.dat

${lockdir}/wins.tdb

Contains the most recent dump of nmbd's internal WINS database. This file is applicable only when the wins support parameter has been enabled in smb.conf.

2.3.2. Reconfiguring Samba

If you have already compiled Samba and wish to recompile the same source code with different configure options, run the following command in the source directory before rerunning the configure script:

$ make distclean

This ensures that you are starting with a clean slate and that your previous configure command does not leave any files laying around that can affect your new build. From here, you can rerun ./configure and then make and make install.

2.3.3. Setting Search Paths

You will probably want to run commands included in the Samba distribution without having to specify their full directory paths. For that to work, the directory in which the Samba executables are located, /usr/local/samba/{bin,sbin} by default, must be added to your shell's PATH environment variable. This environment variable is usually set in one or more of the shell's startup files, which in the case of bash are /etc/profile (systemwide) and the .profile, .bash_profile, and .bashrc files in each user's home directory.

To be able to read the Samba manual pages using the man command, the directory where Samba's manual pages reside, /usr/local/samba/man by default, must be in your MANPATH environment variable. On SUSE Linux, this can be accomplished by adding the following two lines to /etc/manpath.config:

MANPATH /usr/local/samba/man MANPATH_MAP /usr/local/samba/bin /usr/local/samba/man

Other systems might just require a line such as the following in your shell's initialization file:

export MANPATH=$MANPATH:/usr/local/samba/man

Категории