2.4 Compiling and Installing Samba

   

At this point you should be ready to build the Samba executables. Compiling is also easy: 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 compiles for both smbd and nmbd and ends in a linking command for bin/nmblookup . For example, here is a sample make of Samba Version 2.2.6 on a Linux server:

 # make 2>&1  tee make.log Using FLAGS =  -O  -Iinclude -I./include -I./ubiqx -I./smbwrapper -D_LARGEFILE64 _SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE  -DLOGFILEBASE="/usr/local/samba/va r" -DCONFIGFILE="/usr/local/samba/lib/smb.conf" -DLMHOSTSFILE="/usr/local/samba/ lib/lmhosts"   -DSWATDIR="/usr/local/samba/swat" -DSBINDIR="/usr/local/samba/bin " -DLOCKDIR="/usr/local/samba/var/locks" -DCODEPAGEDIR="/usr/local/samba/lib/cod epages" -DDRIVERFILE="/usr/local/samba/lib/printers.def" -DBINDIR="/usr/local/sa mba/bin"  -DHAVE_INCLUDES_H -DPASSWD_PROGRAM="/bin/passwd" -DSMB_PASSWD_FILE="/u sr/local/samba/private/smbpasswd" -DTDB_PASSWD_FILE="/usr/local/samba/private/sm bpasswd.tdb" Using FLAGS32 =  -O  -Iinclude -I./include -I./ubiqx -I./smbwrapper -D_LARGEFILE 64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE  -DLOGFILEBASE="/usr/local/samba/ var" -DCONFIGFILE="/usr/local/samba/lib/smb.conf" -DLMHOSTSFILE="/usr/local/samb a/lib/lmhosts"   -DSWATDIR="/usr/local/samba/swat" -DSBINDIR="/usr/local/samba/b in" -DLOCKDIR="/usr/local/samba/var/locks" -DCODEPAGEDIR="/usr/local/samba/lib/c odepages" -DDRIVERFILE="/usr/local/samba/lib/printers.def" -DBINDIR="/usr/local/ samba/bin"  -DHAVE_INCLUDES_H -DPASSWD_PROGRAM="/bin/passwd" -DSMB_PASSWD_FILE=" /usr/local/samba/private/smbpasswd" -DTDB_PASSWD_FILE="/usr/local/samba/private/ smbpasswd.tdb" Using LIBS = -ldl -lnsl -lpam Compiling smbd/server.c Compiling smbd/files.c Compiling smbd/chgpasswd.c Compiling smbd/connection.c Compiling smbd/utmp.c Compiling smbd/session.c Compiling smbd/dfree.c Compiling smbd/dir.c  ...(content omitted)...  Compiling rpc_server/srv_srvsvc.c Compiling rpc_server/srv_srvsvc_nt.c Compiling rpc_server/srv_util.c Compiling rpc_server/srv_wkssvc.c Compiling rpc_server/srv_wkssvc_nt.c Compiling rpc_server/srv_pipe.c Compiling rpc_server/srv_dfs.c Compiling rpc_server/srv_dfs_nt.c Compiling rpc_server/srv_spoolss.c Compiling rpc_server/srv_spoolss_nt.c Compiling lib/util_getent.c Compiling rpc_parse/parse_lsa.c Compiling rpc_parse/parse_net.c Compiling rpc_parse/parsen/smbmount Compiling client/smbmnt.c Linking bin/smbmnt Compiling client/smbumount.c Linking bin/smbumount Compiling utils/nmblookup.c Linking bin/nmblookup 

If you encounter a problem when compiling, first check the Samba documentation to see if it is easily fixable. Another possibility is to search or post to the Samba mailing lists, 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 into the directories you identified with the command:

 #  make install  

If you happen to be upgrading, your old Samba files will be saved with the extension .old , and you can go back to that previous version with the command make revert . After doing a make install , you should copy the .old files (if they exist) to a new location or name . Otherwise, the next time you install Samba, the original .old will be overwritten without warning and you could lose your earlier version. 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. Remember that you need to perform the installation from an account that has write privileges on these target directories; this is typically the root account.

Table 2-2. Samba installation directories

Directory

Description

/usr/local/samba

Main tree

/usr/local/samba/bin

Binaries

/usr/local/samba/lib

smb.conf , lmhosts , configuration files, etc.

/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 log files, lock files, browse list info , shared memory files, process ID files

Throughout the remainder of the book, we occasionally refer to the location of the main tree as /usr/local/samba . In most configurations, this is the base directory of the installed Samba package; however, it can vary from system to system .

Watch out if you've made /usr a read-only partition. You will want to put the logs, locks, and password files somewhere else.

Here is the installation that we performed on our machine. You can see that we used /usr/local/samba as the base directory for the distribution:

 #  make install 2>&1  tee make-install.log  Using FLAGS =  -O  -Iinclude -I./include -I./ubiqx -I./smbwrapper -D_LARGEFILE64 _SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE  -DLOGFILEBASE="/usr/local/samba/va r" -DCONFIGFILE="/usr/local/samba/lib/smb.conf"  ...(content omitted)...  The binaries are installed. You can restore the old binaries (if there were any) using the command "make revert". You can uninstall the binaries using the command "make uninstallbin" or "make uninstall" to uninstall binaries, manpages and shell scripts.  ...(content omitted)...  ====================================================================== The SWAT files have been installed. Remember to read the swat/README for information on enabling and using SWAT. ====================================================================== 

If the last message is about SWAT, you've successfully installed all the files. Congratulations! You now have Samba on your system!

2.4.1 Upgrading Your Installation

Eventually a new version of Samba will be released, and you will want to upgrade. This is simple; just repeat the same steps you used to install your current version. Download the source distribution from the Samba web site and install it, then run the ./configure , make , and make install commands as before. If you've forgotten which options you used with the configure script, take a look at the source/config.status file in your previous version's source distribution. The first few lines of this file show the options used the last time configure was run.

When you run the make install command to install your new version, the files of the previous version are replaced with the new ones, and then all you have to do is restart the Samba daemons to get your new version running. See Section 2.8 later in this chapter for directions on how to do this.

2.4.2 Reconfiguring Samba

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

 #  autoconf  #  make clean  #  rm config.cache  

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

2.4.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 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 .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 Red Hat Linux, this can be accomplished by adding the following two lines to /etc/man.config :

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


Using Samba
Using Samba: A File and Print Server for Linux, Unix & Mac OS X, 3rd Edition
ISBN: 0596007698
EAN: 2147483647
Year: 2003
Pages: 475

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net