= $stitle ?>
HOWTO: samba
Description: File and printer sharing for SMB/CIFS clients (Linux, Windblows, ...)
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything
# Samba 3.2.13
# ============
# Slackware 11.0: samba 3.0.23c
# Slackware 12.0: samba 3.0.25b
# Slackware 12.1: samba 3.0.28a
# Slackware 12.2: samba 3.2.5
# If you're upgrading from a 2.2.x version, back up everything in
# /usr/local/samba/var/locks/. Samba will upgrade the tdb files in there,
# but if you need to downgrade back to 2.2.x for some reason, you can't
# downgrade those databases. If you have a small Samba installation where
# nothing will be opened (and locked) while you upgrade it, just blow
# everything in there away if you need to downgrade.
# Prerequisites:
# Perl
# PAM (optional; add --with-pam)
# CUPS (optional; used if installed)
# readline
# ncurses
# OpenLDAP (optional; used if installed)
# Kerberos (optional)
# libxml (optional)
# MySQL (optional)
# popt
# OpenSSL or GnuTLS
cd
test -f installed/samba-3.2.13.tar.gz && mv installed/samba-3.2.13.tar.gz .
test ! -f samba-3.2.13.tar.gz &&
wget http://download.samba.org/samba/ftp/samba-3.2.13.tar.gz
# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "aed1c2df274f504d4e7d4883da4581f6 samba-3.2.13.tar.gz" | md5sum -c
# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "68c98900c258d64098d59879153abbb8202cc364 samba-3.2.13.tar.gz" | \
sha1sum -c
# Verify tarball w/ gpg:
( gpg --list-keys 6568B7EA > /dev/null 2>&1 || gpg --recv-keys 6568B7EA ) &&
wget -nc http://download.samba.org/samba/ftp/samba-3.2.13.tar.asc &&
zcat samba-3.2.13.tar.gz | gpg --verify samba-3.2.13.tar.asc - &&
rm samba-3.2.13.tar.asc
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "samba-*" -exec rm -r {} \;
tar xzvf ~/samba-3.2.13.tar.gz
cd samba-3.2.13
test $UID = 0 && chown -R root:root .
cd source
# See ./configure --help for lots of options like --with-ldap (default
# if you have it), --with-pam (not a default), --with-quotas, etc. I never
# use SWAT, so I pass --disable-swat to configure.
./configure --disable-swat
# If make fails saying can't find -lssl, re-run it like this:
# make LDFLAGS="-L/usr/local/ssl/lib"
make
# Become root to install it
su
# Backup your existing Samba configuration file, if you have one
for bf in /etc/samba/smb.conf /usr/local/samba/lib/smb.conf; do
test -f $bf &&
( mkdir -p -m 0700 ~/backup
cp -f $bf ~/backup/`basename $bf`-`date +%Y%m%d` )
done
# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg samba
# There may still be files in /etc/samba, if you're sure you have
# all of the files you need backed up, you can do this (because this
# version of Samba will be in /usr/local/samba)
test -d /etc/samba && rm -r /etc/samba
# Install it
make install
# Add Samba's bin directory to PATH and it's man directory to MANPATH.
# If you have something older than Slack 9, set these "manually" in
# /etc/profile.
echo '#!/bin/sh' > /etc/profile.d/samba.sh
echo 'export PATH=$PATH:/usr/local/samba/bin' >> /etc/profile.d/samba.sh
echo 'export MANPATH=$MANPATH:/usr/local/samba/share/man' \
>> /etc/profile.d/samba.sh
chmod 755 /etc/profile.d/samba.sh
echo $PATH | grep "/usr/local/samba/bin" > /dev/null 2>&1 ||
export PATH=$PATH:/usr/local/samba/bin
echo $MANPATH | grep "/usr/local/samba/share/man" > /dev/null 2>&1 ||
export MANPATH=$MANPATH:/usr/local/samba/share/man
makewhatis
# If you have an old smb.conf backed up (~/backup/smb.conf-yyyymmdd),
# copy it to /usr/local/samba/lib/smb.conf
# If you don't have a smb.conf Here's a simple sample one written for
# Samba 2.2.8a. It will probably work with this version, but I haven't
# tried it lately.
cd /usr/local/samba/lib
test ! -f smb.conf &&
wget http://englanders.us/pub/linux/misc/smb.conf &&
vi smb.conf
# If you're using LDAP, set the LDAP administrator's password in
# private/secrets.tdb:
# /usr/local/samba/bin/smbpasswd -w secret
#
# and install the samba.schema for OpenLDAP's use. Set slapd.conf to use it
# and restart slapd. Check out Samba's docs, there are several man pages
# and various other docs that cover setting up LDAP.
test -d /usr/local/etc/openldap/schema &&
cp ../examples/LDAP/samba.schema /usr/local/etc/openldap/schema/
# Update ld.so.conf so utilities linked with libraries in
# /usr/local/samba/lib will work and so apps that use libsmbclient.so
# can find it.
egrep -q "^/usr/local/samba/lib$" /etc/ld.so.conf > /dev/null 2>&1 ||
( echo "/usr/local/samba/lib" >> /etc/ld.so.conf ; ldconfig )
# Run 'testparm' to verify that your config file is OK
# To start|stop|restart Samba, either set /etc/rc.d/rc.local to start it or
# create a rc.samba rc.M will call it on boot-up if it exists. If you have a
# rc.samba from the old Slackware-installed Samba, open it up in a text editor
# and fix the paths of smbd, nmbd, and the config file in there. If you
# just upgraded from Samba 2.x to 3.x, be aware that smbd and nmbd are in
# /usr/local/samba/sbin now (they were in bin).
#
# This will install an rc.samba for you. If you already had one, and it's
# different than the new one, it'll be renamed rc.samba.old
cd /etc/rc.d
test -f rc.samba &&
( mv -f rc.samba rc.samba.old ; chmod 600 rc.samba.old )
wget http://englanders.us/pub/linux/misc/rc.samba
diff rc.samba.old rc.samba > /dev/null 2>&1 && rm rc.samba.old
chmod 700 rc.samba
chown root:root rc.samba
test -f rc.samba.old &&
( chmod 600 rc.samba.old ; chown root:root rc.samba.old )
# If you've got an old version running, stop it, then start the new Samba:
/etc/rc.d/rc.samba stop
/etc/rc.d/rc.samba start
# If everything goes to hell, you can revert back to the old version (not
# including databases that were converted and config files that you changed)
# by running 'make revert' from the source directory. If you want to
# uninstall Samba you can run 'make uninstall'.
# If you upgraded and everything is running OK, you can remove the old files
# by running this:
cd /usr/local/samba
( cd bin ; rm -f *.old make_printerdef make_smbcodepage make_unicodemap \
nmbd smbd smbprint swat winbindd )
test -d lib/codepages && rm -r lib/codepages
( cd man/man1 ; rm -f make_smbcodepage.1 make_unicodemap.1 )
test -d swat &&
( cd swat/help ; rm -f CVS-Access.html DOMAIN_MEMBER.html ENCRYPTION.html \
Integrating-with-Windows.html NT_Security.html OS2-Client-HOWTO.html \
PAM-Authentication-And-Samba.html Samba-BDC-HOWTO.html \
Samba-LDAP-HOWTO.html Samba-PDC-HOWTO.html UNIX_INSTALL.html cups.html \
make_smbcodepage.1.html make_unicodemap.1.html msdfs_setup.html \
printer_driver2.html )
( cd sbin ; rm -f *.old )
test -d swat/using_samba &&
( cd swat/using_samba
rm -f *_??.html index.html licenseinfo.html this_edition.html \
figs/sam.*.gif
test -d gifs && rm -r gifs )
rm -f var/locks/unexpected.tdb
# Create mount symlinks for smbfs and cifs (so you can do 'mount -t smbfs'
# and 'mount -t cifs')
test -x /usr/local/samba/sbin/mount.cifs &&
ln -sf /usr/local/samba/sbin/mount.cifs /sbin/mount.cifs
test -x /usr/local/samba/sbin/umount.cifs &&
ln -sf /usr/local/samba/sbin/umount.cifs /sbin/umount.cifs
# If you have a CUPS server running on this machine, create/update the "smb"
# symlink so you can print to printers that are attached to a Windows
# machine using the smb backend:
test -d /usr/lib/cups/backend &&
ln -sf /usr/local/samba/bin/smbspool /usr/lib/cups/backend/smb
# Become yourself again
exit
# Add Samba's bin directory to your current (non-root) shell's PATH and it's
# man directory to MANPATH
echo $PATH | grep "/usr/local/samba/bin" > /dev/null 2>&1 ||
export PATH=$PATH:/usr/local/samba/bin
echo $MANPATH | grep "/usr/local/samba/share/man" > /dev/null 2>&1 ||
export MANPATH=$MANPATH:/usr/local/samba/share/man
cd
mkdir -p -m 0700 installed
rm -f installed/samba-*.tar.*
mv samba-3.2.13.tar.gz installed/
# If you'd like to set up a fax printer that you can use through Samba,
# check out my HylaFAX howto
|
Last updated: Fri, 26 Mar 2010 13:18:56 -0400 Jason Englander <jason at englanders dot us> |
|