Netatalk does everything Apple Time Capsule does, for a lot less money

Building the Netatalk Library

To build the Netatalk library successfully, you need the packages installed with the command in Listing  1 [8]. This article refers to version  3.1.0, although a newer version should also work; however, the patch file has only been tested with version  3.1.0.

Listing 1

Netatalk Packages

$ sudo apt-get install libdb-dev libdbus-glib-1-dev \
  libwrap0-dev python-dbus-dev libldap2-dev libgcrypt11-dev \
  libacl1-dev tracker-miner-fs libkrb5-dev libafpclient-dev \
  libafsauthent1 libevent-dev libafsrpc1 systemtap-sdt-dev \
  libcrack2-dev gcc libssl-dev perl flex \
  libmysqlclient-dev libtracker-sparql-0.14-dev libdbus-c++-dev \
  libpam0g-dev python-dbus libopenafs-dev \
  libtracker-miner-0.14-dev linux-headers-rpi-rpfv \

Before creating a directory for unpacking and processing source files, make sure you are in the home directory of the pi user:

$ cd ~ && mkdir src && cd src

Next, download the Netatalk archive with wget, unpack the archive, go into the new directory, and apply the patch (Listing  2, first four lines). The patch prepares the sources to compile error free on the Rasp Pi. Additionally, it corrects a dependency that would not exist without a change to the kernel, adjusts paths, and generates a specific configuration. You should adapt the <path> to the patch as it exists on your system. Finally, execute the configure script with the accompanying parameters.

After the script finishes, check the output to see whether Spotlight and all other Options are set to either yes or auto. You can build and install the package with

make &&sudo make install

then add the Netatalk service to the automatic boot process and generate the CrackLib word list (for strong passwords), as well as the AFP password file (for Netatalk password management; Listing 2, sudo lines).

Listing 2

Getting Netatalk

$ wget
$ tar -xvf netatalk-3.1.0.tar.gz
$ cd netatalk-3.1.0
$ patch -Np1 < <path>/netatalk_3.1.0-1+rpi.patch
$ ./configure --prefix=/usr --disable-maintainer-mode --enable-fhs \
  --with-cracklib --with-init-style=debian --enable-quota \
  --with-shadow --enable-krbV-uam --with-cnid-dbd-backend \
  --with-cnid-cdb-backend --with-tracker-pkgconfig-version=0.14 \
  --with-cnid-default-backend=dbd LDFLAGS="-lafsauthent -lpthread"
$ sudo update-rc.d netatalk defaults
$ sudo create-cracklib-dict -o /usr/lib/cracklib_dict /usr/share/dict/words
$ sudo gzip /usr/lib/cracklib_dict.pwd
$ sudo afppasswd -c
$ cp -v /etc/nsswitch.conf{,.orig}
$ sed -i '/^hosts: /s/$/ mdns/' /etc/nsswitch.conf

Whereas Mac OS  X uses the Bonjour protocol (zeroconf) to find devices in the network, Linux uses the Avahi daemon. To use this daemon, you should create the /etc/avahi/services/afpd.service configuration file and add the lines from Listing  3.

Listing 3

Setting Up Avahi

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

Next, you need to add the mdns entry to the hosts:file db list in the /etc/nsswitch.conf (last two lines of Listing  2).

Using the Prebuilt Package

To download the Debian Netatalk package netatalk_3.1.0-1+rpi_armhf.deb, enter the command shown in Listing  4, line  1. Installation of the package requires the GDebi program (lines  2 and  3).

Listing 4

Installing the Prebuilt Package

$ wget -O netatalk_3.1.0-1+rpi_armhf.deb
$ sudo apt-get install gdebi-core
$ sudo gdebi netatalk_3.1.0-1+rpi_armhf.deb

The program lets you know that the system needs a few more components for the package that you are installing to work, and you should confirm this message by entering Y.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content