[Samba] Multiple Instancies of Samba on a single System

Gary Algier gaa at ulticom.com
Fri Mar 1 13:34:05 GMT 2002


Yes, this works, however, you probably will want to build different
executables.  I first got it to work starting the daemons with
different configuration files, but then I had a problem with
smbpasswd: it has no config file option.  You can't make it
work differently for the different servers.  I just did multiple
configure/make runs:

     ./configure \
         --with-configdir=/etc/samba-red \
         --libdir=/etc/samba-red \
         --sharedstatedir=/var/samba-red/run \
         --localstatedir=/var/samba-red/run \
         --with-privatedir=/etc/samba-red/private \
         --with-lockdir=/var/samba-red/locks \
         ... && make &&
     make install INSTALLCMD="/bin/sh `/bin/pwd`/source/install-sh -t='s/^/red-/'" &&
     make clean

     ./configure \
         --with-configdir=/etc/samba-blue \
         --libdir=/etc/samba-blue \
         --sharedstatedir=/var/samba-blue/run \
         --localstatedir=/var/samba-blue/run \
         --with-privatedir=/etc/samba-blue/private \
         --with-lockdir=/var/samba-blue/locks \
         ... && make &&
     make install INSTALLCMD="/bin/sh `/bin/pwd`/source/install-sh -t='s/^/blue-/'" &&
     make clean

With this the smpbasswd that uses the /etc/samba-red/smb.conf file is named
"red-smbpasswd", etc.

However, to get the install to work correctly I needed to force the Makefile
to use the proper install-sh, not the in-line copies as the Makefile is
supplied.  The install-sh can do name translations.  The patch to make this
happen is:

Index: source/Makefile.in
===================================================================
RCS file: /u/itsrc/cvs/networking/fs/samba/source/Makefile.in,v
retrieving revision 1.1.1.10
retrieving revision 1.1.1.10.2.1
diff -u -r1.1.1.10 -r1.1.1.10.2.1
--- Makefile.in 2002/02/06 16:18:58     1.1.1.10
+++ Makefile.in 2002/02/07 18:25:01     1.1.1.10.2.1
@@ -21,7 +21,7 @@

  LINK=$(CC) $(FLAGS) $(LDFLAGS)

-INSTALLCMD=@INSTALL@
+INSTALLCMD=/bin/sh @srcdir@/install-sh

  VPATH=@srcdir@
  srcdir=@srcdir@
@@ -654,18 +654,23 @@
  install: installbin installman installscripts installcp installswat

  installdirs:
-       $(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) \
+       $(INSTALLCMD) -d -m $(INSTALLPERMS) \
         $(BASEDIR) $(SBINDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(CODEPAGEDIR)

  installservers: all installdirs
-       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS)
+       @echo Installing $(SPROGS) to $(SBINDIR)
+       @for f in $(SPROGS) ; do $(INSTALLCMD) -c -m $(INSTALLPERMS) $$f $(SBINDIR) ; done

  installbin: all installdirs
-       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS) $(WINBIND_SPROGS)
-       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS) $(WINBIND_PROGS)
+       @echo Installing $(SPROGS) $(WINBIND_SPROGS) to $(SBINDIR)
+       @for f in $(SPROGS) $(WINBIND_SPROGS) ; do $(INSTALLCMD) -c -m $(INSTALLPERMS) $$f $(SBINDIR) ; done
+       @echo Installing $(PROGS) $(WINBIND_PROGS) to $(SBINDIR)
+       @for f in $(PROGS) $(WINBIND_PROGS) ; do $(INSTALLCMD) -c -m $(INSTALLPERMS) $$f $(BINDIR) ; done

  installscripts: installdirs
-       @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS)
+       @echo Installing $(SCRIPTS) to $(BINDIR)
+       @for f in  $(SCRIPTS) ; do $(INSTALLCMD) -c -m $(INSTALLPERMS) $$f $(BINDIR) ; done
+

  installcp: installdirs installbin
         @$(SHELL) $(srcdir)/script/installcp.sh $(srcdir) $(LIBDIR) $(CODEPAGEDIR) $(BINDIR) $(CODEPAGELIST)

Index: source/script/installcp.sh
===================================================================
RCS file: /u/itsrc/cvs/networking/fs/samba/source/script/installcp.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.30.1
diff -u -r1.1.1.1 -r1.1.1.1.30.1
--- installcp.sh        2001/04/20 14:30:40     1.1.1.1
+++ installcp.sh        2002/02/07 18:25:02     1.1.1.1.30.1
@@ -23,11 +23,11 @@
  for p in $*; do
   if [ -f ${srcdir}/codepages/codepage_def.$p ]; then
     echo Creating codepage file $CODEPAGEDIR/codepage.$p
-   $BINDIR/make_smbcodepage c $p ${srcdir}/codepages/codepage_def.$p $CODEPAGEDIR/codepage.$p
+   ${srcdir}/bin/make_smbcodepage c $p ${srcdir}/codepages/codepage_def.$p $CODEPAGEDIR/codepage.$p
   fi
   if [ -f ${srcdir}/codepages/CP${p}.TXT ]; then
     echo Creating unicode map $CODEPAGEDIR/unicode_map.$p
-   $BINDIR/make_unicodemap $p ${srcdir}/codepages/CP${p}.TXT $CODEPAGEDIR/unicode_map.$p
+   ${srcdir}/bin/make_unicodemap $p ${srcdir}/codepages/CP${p}.TXT $CODEPAGEDIR/unicode_map.$p
   fi
  done

[If these changes became part of the official code, it would be nice so we
could take advantage of the options supported by install-sh.]

Gunther Hess wrote:
> Hi out there,
>              i intend to run multiple Instancies of Samba
> on a single, multi-homed, server, with each instance bound
> to a specific (logical) interface.
> 
> If this works, it would be fine to me. 
> Mainly for administrative Reasons. (You won't believe, 
> but from time to time it becomes necessary to restart
> some services, but restarting the entire server is a
> real mess)
> 
> Well here my questions:
> 
>  - Most important: 
>    Can anyone out there tell me, that this is definitely impossible?
> 
>  - Most helpful: 
>    Which settings must appear in the Configuration, to split the
>    working-directories? (locks, logs, private-dir and so on)
> 
>  - Very interesting:
>    Has anyone experience with such a configuration?
> 
> Thanks in advance
> Gunther
> 


-- 
Gary Algier, WB2FWZ          gaa at ulticom.com             +1 856 787 2758
Ulticom Inc., 1020 Briggs Rd, Mt. Laurel, NJ 08054      Fax:+1 856 866 2033

        A self-addressed envelope would be addressed "envelope."





More information about the samba mailing list