Old SAMBA-Install Documentation

Table of Contents

1. Introduction
1.1. Disclaimer
2. Installing the new level
2.1. Description
2.2. Terminating and restarting Samba
2.3. Postinstall (bin)
2.4. Postinstall (man)
2.4.1. Postinstall (man 2)
2.4.2. Postinstall (man 3)

1. Introduction

This part of the simple Samba web site has been replaced by a newer version. If you have problems with that new version or you are installing an old level such as 1.9.18p10, this may conceivably be of interest to you.

1.1. Disclaimer

This document and all associated documents are provided on an 'as is' basis, the author assumes no liability for damage directly or indirectly caused by following this advice.
This warning is here as a precaution, I have no reason to believe that there is anything wrong with the advice here, but you never know . . .

2. Installing the new level

2.1. Description

This description is written for Linux and the Bash shell. There is a fundamental difference between normal 'installed' versions of Samba and those that are downloaded - the original ones are integrated into the standard files and downloaded ones land in the /usr/local/samba tree.
Under SuSE for example:
  • The Daemons (smbd and nmbd) are in /usr/sbin
  • All other executables are in /usr/bin
  • smb.conf is in /etc
  • smbpasswd (the password file, not the executable!) is in /etc/private
  • The man pages are in the /usr/man/ subdirectories AND the /usr/man/allman subdirectories. In addition, they are in .gz format under SuSE
I work with symbolic links here in most cases, the exception being the man pages.

With the daemons and executables, I rename the files in /usr/bin and /usr/sbin, setting symbolic links then to the new versions in /usr/local/samba/bin. This only needs to be done once, the next new level automatically points to the right files once the 'samba' symbolic link has been reset.

In the case of smb.conf (and lmhosts), I prefer setting the link to go the other direction - a new version of Samba still wants the old config.

smbpasswd is not a problem - smb.conf contains it's full path.

The man-pages are a nuisance - I end up deleting the old ones and copying the new ones to the /usr/man subdirectories. Deleting the old ones must (of course) only be done once, copying the new ones (of course) every time.

With Samba 2.0.4, add the --with-pam option to ./configure if your system uses PAM.  This change was introduced to handle a problem with FreeBSD.

There is a known problem with Slackware 3.4 (at least) - the GCC binaries are broken, gcc comes up with an 'Internal compiler error: program cc1 got fatal signal 6'.  Removing the '-O' option from FLAGS1 in the Makefile sometimes works, downloading decent libraries always does.

While I have scripts for some of this, they are pretty primitive and do not do all the work.
The 10 (or so) steps to heaven are:

  • Obtain the new level from a Mirror-Site
  • Go to /usr/local and issue

  •     gunzip -c samba-x.x.x.tar.gz | tar xf -
    you will now have a new directory: /usr/local/samba-1.9.18p10 (for example)
  • Go to subdirectory 'source' in this new directory
  • For 2.0 levels, you can now issue './configure' to create your makefile.

  • If you have a 1.x level (and why are you installing an old level?) then you will have to edit 'Makefile' in this directory. A Samba generated under a Linux 2.0 Kernel will not work under 2.1 or 2.2 kernels, you will have to repeat things starting with this step.
    configure has a --help option if you want to influence it's behaviour using other options, if you are using a Linux 2.2 kernel or above, try the --with-smbmount option.
  • make (if you have changed something and are repeating this step, you can do a 'make clean' first)
  • Up until now, you have not actually done anything to your existing Samba. This is about to change - you now need to set the link:

  •     cd /usr/local
        ln -s samba-1.9.18p10 samba (for example)
    This does not do anything to your existing Samba if the old one is an 'installed' one
  • Go back to samba/source and issue 'make install'
  • You will now need to do what this script does - the first time - otherwise only the smb.conf link needs resetting.
  • The last step is to replace the man pages.  You can use the primitive scripts provided below for this, or the new sexy Perl-script.
Hopefully this will work for you. It works for me and I carried out most of the steps in parallel while writing this section.

2.2. Terminating and Restarting Samba

#! /bin/sh
#
# Kill and restart Samba
#
echo -n "Shutting down Samba: "
killproc -TERM /usr/sbin/nmbd
killproc -TERM /usr/sbin/smbd
echo
echo -n "Hit XMIT to delete logs and restart"
read
rm /var/log/samba-log.*
rm /var/log/log.*
echo -n "Restarting Samba "
/usr/sbin/nmbd -D
/usr/sbin/smbd -D
echo " done"
As you will see, it also kills the log files left by the previous version.  You will probably have to change some names because your Samba executables and log files are likely to be somewhere else.  The 2 lines:
         echo -n "Hit XMIT to delete logs and restart"
   and   read
are there because I sometimes want to change something while Samba is down.

For UNIXes/Linux distributions without killproc (Caldera seems to be an example), take a look at killall.  I am told that killall kills *all* processes under Solaris (this seems rather insane), so take a *very*good* look at it before you use it.

2.3. Postinstall (bin)

I use the SuSE Linux distribution and it puts the Samba daemons and executables in /usr/bin or /usr/sbin.  When I download and install Samba (make install), the whole lot lands in /usr/local/samba/bin. This script sets up symbolic links from one to the other.  It only needs to be run once - although the smb.conf and lmhosts lines at the end need to be carried out every time.

Note that versions below 2.0.x do not have 'swat'.

#! /bin/sh
#
#  Kill, install and restart Samba
#
echo -n "Shutting down Samba: "
killproc -TERM /usr/sbin/nmbd
killproc -TERM /usr/sbin/smbd
echo
echo "Installing new 2.0.x Version: Daemons"
rm -f /usr/sbin/nmbd.old
rm -f /usr/sbin/smbd.old
rm -f /usr/sbin/swat.old
mv /usr/sbin/nmbd /usr/sbin/nmbd.old
mv /usr/sbin/smbd /usr/sbin/smbd.old
mv /usr/sbin/swat /usr/sbin/swat.old
ln -s /usr/local/samba/bin/nmbd /usr/sbin/nmbd
ln -s /usr/local/samba/bin/smbd /usr/sbin/smbd
ln -s /usr/local/samba/bin/swat /usr/sbin/swat
echo "Installing new Version: Programs"
rm -f /usr/bin/smbclient.old
rm -f /usr/bin/testparm.old
rm -f /usr/bin/testprns.old
# rm -f /usr/bin/smbrun.old
rm -f /usr/bin/smbstatus.old
rm -f /usr/bin/smbpasswd.old
rm -f /usr/bin/nmblookup.old
rm -f /usr/bin/rpcclient.old
# if recompiled: rm -f /usr/bin/smbmount.old
rm -f /usr/bin/smbmnt.old
# if recompiled: rm -f /usr/bin/smbumount.old
rm -f /usr/bin/make_printerdef.old
rm -f /usr/bin/make_smbcodepage.old
mv /usr/bin/smbclient /usr/bin/smbclient.old
mv /usr/bin/testparm /usr/bin/testparm.old
mv /usr/bin/testprns /usr/bin/testprns.old
# mv /usr/bin/smbrun /usr/bin/smbrun.old
mv /usr/bin/smbstatus /usr/bin/smbstatus.old
mv /usr/bin/smbpasswd /usr/bin/smbpasswd.old
mv /usr/bin/nmblookup /usr/bin/nmblookup.old
mv /usr/bin/rpcclient /usr/bin/rpcclient.old
mv /usr/bin/smbmount /usr/bin/smbmount.old
mv /usr/bin/smbmnt /usr/bin/smbmnt.old
mv /usr/bin/smbumount /usr/bin/smbumount.old
mv /usr/bin/make_printerdef /usr/bin/make_printerdef.old
mv /usr/bin/make_smbcodepage /usr/bin/make_smbcodepage.old
ln -s /usr/local/samba/bin/smbclient /usr/bin/smbclient
ln -s /usr/local/samba/bin/testparm /usr/bin/testparm
ln -s /usr/local/samba/bin/testprns /usr/bin/testprns
# ln -s /usr/local/samba/bin/smbrun /usr/bin/smbrun
ln -s /usr/local/samba/bin/smbstatus /usr/bin/smbstatus
ln -s /usr/local/samba/bin/smbpasswd /usr/bin/smbpasswd
ln -s /usr/local/samba/bin/nmblookup /usr/bin/nmblookup
ln -s /usr/local/samba/bin/rpcclient /usr/bin/rpcclient
# if recompiled: ln -s /usr/local/samba/bin/smbmount /usr/bin/smbmount
ln -s /usr/local/samba/bin/smbmnt /usr/bin/smbmnt
# if recompiled: ln -s /usr/local/samba/bin/smbumount /usr/bin/smbumount
ln -s /usr/local/samba/bin/make_printerdef /usr/bin/make_printerdef
ln -s /usr/local/samba/bin/make_smbcodepage /usr/bin/make_smbcodepage
ln -s /etc/smb.conf /usr/local/samba/lib/smb.conf
ln -s /etc/lmhosts /usr/local/samba/lib/lmhosts
echo
echo -n "Restarting Samba: "
/usr/sbin/nmbd -D
/usr/sbin/smbd -D
echo " done"

To repeat - the symbolic links for smb.conf and lmhosts need to be set up for every new release.
The script runs after make install or make installbin, make install has the advantage that it sets up code-pages etc. as well.

2.4. Postinstall (man)

This runs after make installman but it is needed for each new release.  There is an additional problem under SuSE - the man-pages are zipped and man goes for the .gz version first.  This script cannot handle this, I had to go in and delete the things by hand.  The next two scripts do that.
If you have Perl, you might want to have a look at the newer version of this - it does the work of all three scripts in this subsection.

#! /bin/sh
#
#  Install man pages
#
echo
echo "Installing new Version: man pages"
cp /usr/local/samba/man/man1/*.1 /usr/local/man/man1/
cp /usr/local/samba/man/man5/*.5 /usr/local/man/man5/
cp /usr/local/samba/man/man7/*.7 /usr/local/man/man7/
cp /usr/local/samba/man/man8/*.8 /usr/local/man/man8/
echo " done"

2.4.1. SuSE Postinstall (man 2)

This one deletes the man-pages as used by SuSE:

rm /usr/man/man1/make_smbcodepage.1.gz
rm /usr/man/man1/nmblookup.1.gz
rm /usr/man/man1/smbclient.1.gz
rm /usr/man/man1/smbrun.1.gz
rm /usr/man/man1/smbstatus.1.gz
rm /usr/man/man1/smbtar.1.gz
rm /usr/man/man1/testparm.1.gz
rm /usr/man/man1/testprns.1.gz
rm /usr/man/man5/lmhosts.5.gz
rm /usr/man/man5/smb.conf.5.gz
rm /usr/man/man5/smbpasswd.5.gz
rm /usr/man/man7/samba.7.gz
rm /usr/man/man8/nmbd.8.gz
rm /usr/man/man8/smbd.8.gz
rm /usr/man/man8/smbmnt.8.gz
rm /usr/man/man8/smbmount.8.gz
rm /usr/man/man8/smbpasswd.8.gz
rm /usr/man/man8/smbumount.8.gz
rm /usr/man/man8/swat.8.gz

2.4.2. SuSE Postinstall (man 3)

And this one is necessary with SuSE when the 'allman' package has been installed.

rm /usr/man/allman/man1/make_smbcodepage.1.gz
rm /usr/man/allman/man1/nmblookup.1.gz
rm /usr/man/allman/man1/smbclient.1.gz
rm /usr/man/allman/man1/smbrun.1.gz
rm /usr/man/allman/man1/smbstatus.1.gz
rm /usr/man/allman/man1/smbtar.1.gz
rm /usr/man/allman/man1/testparm.1.gz
rm /usr/man/allman/man1/testprns.1.gz
rm /usr/man/allman/man5/lmhosts.5.gz
rm /usr/man/allman/man5/smb.conf.5.gz
rm /usr/man/allman/man5/smbpasswd.5.gz
rm /usr/man/allman/man7/samba.7.gz
rm /usr/man/allman/man8/nmbd.8.gz
rm /usr/man/allman/man8/smbd.8.gz
rm /usr/man/allman/man8/smbmnt.8.gz
rm /usr/man/allman/man8/smbmount.8.gz
rm /usr/man/allman/man8/smbpasswd.8.gz
rm /usr/man/allman/man8/smbumount.8.gz
rm /usr/man/allman/man8/swat.8.gz

*** End of the Document ***