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/make_ printerdef. For example, here is a sample make of Samba version 2.0.4 on a Linux server:
#
make
Using FLAGS = -O -Iinclude -I./include -I./ubiqx -I./smbwrapper -DSMBLOGFILE="/usr/local/samba/var/log.smb" -DNMBLOGFILE="/usr/local/samba/var/log.nmb" -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" -DSMBRUN="/usr/local/samba/bin/smbrun" -DCODEPAGEDIR="/usr/local/samba/lib/codepages" -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"
Using FLAGS32 = -O -Iinclude -I./include -I./ubiqx -I./smbwrapper -DSMBLOGFILE="/usr/local/samba/var/log.smb" -DNMBLOGFILE="/usr/local/samba/var/log.nmb" -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" -DSMBRUN="/usr/local/samba/bin/smbrun" -DCODEPAGEDIR="/usr/local/samba/lib/codepages" -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"
Using LIBS = -lreadline -ldl -lcrypt -lpam
Compiling smbd/server.c
Compiling smbd/files.c
Compiling smbd/chgpasswd.c
...(content omitted)...
Compiling rpcclient/cmd_samr.c
Compiling rpcclient/cmd_reg.c
Compiling rpcclient/cmd_srvsvc.c
Compiling rpcclient/cmd_netlogon.c
Linking bin/rpcclient
Compiling utils/smbpasswd.c
Linking bin/smbpasswd
Compiling utils/make_smbcodepage.c
Linking bin/make_smbcodepage
Compiling utils/nmblookup.c
Linking bin/nmblookup
Compiling utils/make_printerdef.c
Linking bin/make_printerdef
If you encounter problems when compiling, 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 appd-34717, 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.
Directory | Description |
---|---|
/usr/local/samba | |
/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 samba_dir
. In most configurations, this is the base directory of the installed Samba package: /usr/local/samba .
WARNING: 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 (e.g., samba_dir
):
# make install
Using FLAGS = -O -Iinclude -I./include -I./ubiqx -I./smbwrapper -DSMBLOGFILE="/usr/local/samba/var/log.smb" -DNMBLOGFILE="/usr/local/samba/var/log.nmb" -DCONFIGFILE="/usr/local/samba/lib/smb.conf" -
...(content omitted)...
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.
...(content omitted)...
============================================================
The SWAT files have been installed. Remember to read the
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!
There are a couple of final steps to perform. Specifically, add the Samba Web Administration Tool (SWAT) to the /etc/services and /etc/inetd.conf configuration files. SWAT runs as a daemon under inetd and provides a forms-based editor in your web browser for creating and modifying SMB configuration files.
swat 901/tcp
Add these lines to /etc/inetd.conf. (Check your inetd.conf manual page to see the exact format of the inetd.conf file if it differs from the following example.) Don't forget to change the path to the SWAT binary if you installed it in a different location from the default /usr/local/samba.
swat stream tcp nowait.400 root /usr/local/samba/bin/swat swat
And that's pretty much it for the installation. Before you can start up Samba, however, you need to create a configuration file for it.