Build Samba 4.6.x with Time Machine support on Ubuntu 16.04

You’ve managed to find this tutorial before my commentary or other helpful notes have been added. This means it hasn’t been fully tested. Hopefully you’ll be able to reproduce the same results, but just because I have a working setup doesn’t mean you will. Think before you type; even more so before hitting enter. If you decide to follow this guide – please leave a comment with your feedback, questions, fixes or anything else that could be help others.

Samba is the standard Windows interoperability suite of programs for Linux and Unix.

Since 1992, Samba has provided secure, stable and fast file and print services for all clients using the SMB/CIFS protocol, such as all versions of DOS and Windows, OS/2, Linux and many others.

Samba is an important component to seamlessly integrate Linux/Unix Servers and Desktops into Active Directory environments. It can function both as a domain controller or as a regular domain member.

Samba is a software package that gives network administrators flexibility and freedom in terms of setup, configuration, and choice of systems and equipment. Because of all that it offers, Samba has grown in popularity, and continues to do so, every year since its release in 1992.

With Time Machine, you can back up your entire Mac, including system files, apps, music, photos, emails, and documents. When Time Machine is turned on, it automatically backs up your Mac and performs hourly, daily, and weekly backups of your files.

When you use Time Machine on a portable computer, Time Machine not only keeps a copy of everything on your backup disk, it also saves “local snapshots” of files that have changed on your internal disk, so you can recover previous versions. These local snapshots are made hourly, unless you deselect Back Up Automatically, and they’re stored on your portable computer’s internal disk.

Install required package dependencies.

apt-get update && apt-get --yes install build-essential acl attr \
  autoconf bison debhelper dnsutils docbook-xml docbook-xsl flex \
  gdb krb5-user libacl1-dev libaio-dev libattr1-dev libblkid-dev \
  libbsd-dev libcap-dev libcups2-dev libgnutls28-dev libjson-perl \
  libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl \
  libpopt-dev libreadline-dev perl perl-modules pkg-config \
  python-all-dev python-dev cups python-dnspython python-crypto \
  xsltproc zlib1g-dev libsystemd-dev libgpgme11-dev python-gpgme \
  python-m2crypto libtracker-sparql-1.0-dev

Download and extract the current release of Samba.

mkdir /build
cd /build
curl -L https://download.samba.org/pub/samba/stable/samba-4.6.5.tar.gz -o samba-4.6.5.tar.gz
tar xvf samba-4.6.5.tar.gz
cd samba-4.6.5/

Patch the downloaded Samba source code with Time Machine support. This patch is currently a Github pull request awaiting acceptance from the Samba-Team developers.

curl -L https://github.com/samba-team/samba/pull/64.patch -o time_machine-fullsync.patch
patch -p 1 < time_machine-fullsync.patch

Configure the source code in preparation for make and install.

./configure \
 --enable-spotlight \
 --with-systemd \
 --prefix=/usr \
 --exec-prefix=/usr \
 --sysconfdir=/etc \
 --libdir=/usr/lib/aarch64-linux-gnu \
 --localstatedir=/var \
 --with-smbpasswd-file=/etc/samba/smbpasswd \
 --enable-fhs

Make and install.

make -j 2
make -j 2 install

Prepare the configuration files and CUPS print server SMB spooler support.

touch /etc/samba/lmhosts
touch /etc/samba/smb.conf
touch /etc/samba/smbpasswd
cp /build/samba-4.6.5/examples/smb.conf.default /etc/samba/smb.conf.default
ln -v -sf /usr/bin/smbspool /usr/lib/cups/backend/smb

Move systemd services into place.

cd /build/samba-4.6.5/packaging/systemd/
cp *.service /lib/systemd/system/

Start and enable the defaut Samaba services.

systemctl start nmb.service
systemctl enable nmb.service
systemctl start smb.service
systemctl enable smb.service
systemctl start winbind.service
systemctl enable winbind.service

Check the status of our enabled Samba install.

smbd -b

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s