# The mount.cifs command that used to be packaged with Samba is cifs-utils
# now. There is a cifs-utils Slackware package starting with 14.0
# If you are upgrading a source-installed version, and want to clean up
# old files before installing the new version, back up everything, stop
# Samba (smbd, nmbd), then as root, run 'make uninstall' in the source
# directory.
# If you're upgrading from a 2.2.x version, back up everything in
# /var/locks/ or whatever path you use for the "lock directory" setting in
# smb.conf 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.
# Install Perl bits as root
su -
perl -MCPAN -e shell
install Bundle::CPAN
install Parse::Yapp
quit
# Get the tarball
cd
test -f installed/samba-4.19.0.tar.gz && mv installed/samba-4.19.0.tar.gz .
test ! -f samba-4.19.0.tar.gz &&
wget https://download.samba.org/pub/samba/stable/samba-4.19.0.tar.gz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "28f98ceab75a6a59432912fa110fc8c716abcab1ed6d8bdd4393d178acff3d\
20 samba-4.19.0.tar.gz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "samba-*" -exec rm -r {} \;
tar xzvf ~/samba-4.19.0.tar.gz
cd samba-4.19.0
test $UID = 0 && chown -R root:root .
# Read at least ./README.md and if upgrading, ./WHATSNEW.txt
# See ./configure --help for lots of options like --with-ldap (default
# if you have it), --with-pam, --with-quotas, etc. It is not an autoconf
# configure, it is a waf one.
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --enable-fhs --prefix=/usr --sysconfdir=/etc \
--libdir=/usr/lib64 --mandir=/usr/man --localstatedir=/var \
--without-ldap --without-pam --without-ads --without-ad-dc
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/man \
--localstatedir=/var \
--without-ldap --without-pam --without-ads --without-ad-dc
# If you have your OpenSSL installed with the < 1.1.0 default prefix of
# /usr/local/ssl and make fails saying can't find -lssl, try this, adjusting
# for wherever yours actually is:
# make LDFLAGS="-L/usr/local/ssl/lib64"
# Build it
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
# If you want to make sure that you have no conflicting old files and
# want to (re-)start with sample config files. Back up everything first,
# you may loose accounts and such by doing this, move old files in these
# locations elsewhere until everything is cleaned up and working.
# /etc/samba
# /usr/lib/samba
# /usr/lib64/samba
# /usr/libexec/samba
# /usr/share/samba
# /var/cache/samba
# /var/lib/samba
# /var/log/samba
# /var/run/samba
# Install it
make install
ldconfig
# If you install Samba with a prefix other than /usr, create a
# /etc/profile.d/samba.sh to update PATH and MANPATH to reflect where things
# are - e.g. /usr/local/samba/bin and /usr/local/samba/share/man
# If you have an old smb.conf backed up (~/backup/smb.conf-yyyymmdd),
# perhaps rename the sample Samba-distribution smb.conf to smb.conf.dist,
# then copy your backed up one to /etc/samba/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 /etc/samba
test ! -f smb.conf &&
wget https://englanders.us/pub/linux/misc/smb.conf )
# Here's another from the Samba source
cp -a examples/smb.conf.default /etc/samba/smb.conf.default
# If you're using LDAP, set the LDAP administrator's password in
# private/secrets.tdb:
# 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/
# If you use prefix /usr/local/samba (we use /usr above), update
# /etc/ld.so.conf and then run ldconfig so building software that needs
# to be linked with libraries in /usr/local/samba/lib*/ will work
# Run 'man smb.conf' and see the sample configuration for guidance
# The Wiki and other docs are available on the Samba web site:
# https://www.samba.org/samba/docs/
# 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 verify that the paths of smbd, nmbd, and the config file are
# OK in there. If you just upgraded from Samba 2.x to 3.x, be aware that
# smbd and nmbd are in /usr/sbin now (they were in bin before).
#
# You can also find some example scripts in the source under packaging/
#
# This will install a 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 https://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'.
# (I have not tested this)
# 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/bin/smbspool /usr/lib/cups/backend/smb
test -d /usr/lib64/cups/backend &&
ln -sf /usr/bin/smbspool /usr/lib64/cups/backend/smb
# Become yourself again
exit
# If you used the default prefix of /usr/local/samba (we use /usr above),
# add Samba's bin directory to your current (non-root) shell's PATH and it's
# man directory to MANPATH
test -f /etc/profile.d/samba.sh && . /etc/profile.d/samba.sh
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/samba-*.tar.*
mv samba-4.19.0.tar.gz installed/
# If you'd like to set up a fax printer that you can use through Samba,
# check out my HylaFAX howto