Custom Time Capsule (Time Machine)
Posted on Sat 30 December 2017 in linux
Instead of buying an expensive AirPort Time Capsule to make backups of your Apple devices, you can simply setup the corresponding service on your NAS or own server.
On Debian, basically two packages are required the netatalk
package for the
Apple Filing Protocol (afp) and the avahi-daemon
to announce the service on the local network.
However, even on the newest Debian 9.3 "Stretch" only netatalk
version 2.2 is
available, which is quite old and hard to configure. To circumvent this problem
a new package is built from the source using the Debian-way:
Uninstalling the existing netatalk
version
First, make sure that the old version of netatalk (2.x) is uninstalled to avoid strange side effects. (If you have a running version make sure to backup the corresponding config files first!)
apt-get remove netatalk --purge
rm -R /etc/netatalk
Building the new netatalk
version
Afterwards, the packages that are required to build the package have to be installed:
apt-get install build-essential devscripts debhelper cdbs autotools-dev dh-buildinfo libdb-dev libwrap0-dev libpam0g-dev libcups2-dev libkrb5-dev libltdl3-dev libgcrypt11-dev libcrack2-dev libavahi-client-dev libldap2-dev libacl1-dev libevent-dev d-shlibs dh-systemd
Subsequently, clone the source code that already contains the required Debian package structure from the following git repository:
git clone https://github.com/adiknoth/netatalk-debian
Then, use debuild
to build debian packages from the source:
cd netatalk-debian
debuild -b -uc -us
cd ..
As a result, a couple of .deb
packages will be created, including some development packages. However, here just the library and the daemon packages are installed:
dpkg -i libatalk18_3.1.11-1_amd64.deb netatalk_3.1.11-1_amd64.deb
Configuration
The configuration of version 3.x has been simplified so that basically only
the /etc/netatalk/afp.conf
must be adapted. For instance, a simple
time machine entry can be added to the end of the config file:
[TimeMachine]
path = /var/lib/timemachine/myuser
time machine = yes
vol size limit = 500000
valid users = myuser
Finally, make sure that the netatalk
service is started as well as the avahi-daemon
so that the service can be discovered by the Apple devices:
systemctl enable avahi-daemon
systemctl enable netatalk
systemctl start avahi-daemon
systemctl start netatalk
If not commented, the home directories should be available on your Apple computer as well as the new time machine destination.