2.3. Compiling and Installing SambaAt 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.
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 InstallationEventually 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.[*]
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.
2.3.2. Reconfiguring SambaIf 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 PathsYou 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 |