安装编译环境

sudo apt install -y \
build-essential \
libevent-dev \
libssl-dev \
libgcrypt20-dev \
libkrb5-dev \
libpam0g-dev \
libwrap0-dev \
libdb-dev \
libtdb-dev \
default-libmysqlclient-dev \
avahi-daemon \
libavahi-client-dev \
libacl1-dev \
libldap2-dev \
libcrack2-dev \
systemtap-sdt-dev \
libdbus-1-dev \
libdbus-glib-1-dev \
libglib2.0-dev \
libio-socket-inet6-perl \
tracker \
libtracker-sparql-2.0-dev \
libtracker-miner-2.0-dev

下载源码

wget http://prdownloads.sourceforge.net/netatalk/netatalk-${NETATALK_VERSION}.tar.gz 
tar -xzf netatalk-${NETATALK_VERSION}.tar.gz
cd netatalk-${NETATALK_VERSION}

编译准备

./configure \
    --with-init-style=debian-systemd \ 
    --without-libevent \                                                              
    --without-tdb \
    --with-cracklib \
    --enable-krbV-uam \
    --with-pam-confdir=/etc/pam.d \
    --with-dbus-daemon=/usr/bin/dbus-daemon \
    --with-dbus-sysconf-dir=/etc/dbus-1/system.d \
    --with-tracker-pkgconfig-version=2.0

如果成功,输出如下内容

Compilation summary:
    CPPFLAGS       = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_srcdir) 
    CFLAGS         = -D_U_="__attribute__((unused))" -g -O2
    LIBS           =  -lcrack
    PTHREADS:
        LIBS   = 
        CFLAGS = -pthread
    TRACKER:
        LIBS   = -ltracker-sparql-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
        CFLAGS = -pthread -I/usr/include/tracker-2.0 -I/usr/include/tracker-2.0/libtracker-sparql -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
    SSL:
        LIBS   =  -L/usr/lib64 -lcrypto
        CFLAGS =  -I/usr/include/openssl
    LIBGCRYPT:
        LIBS   = -lgcrypt
        CFLAGS = 
    PAM:
        LIBS   =  -lpam
        CFLAGS = 
    WRAP:
        LIBS   = -lwrap
        CFLAGS = 
    BDB:
        LIBS   =  -L/usr/lib64 -ldb-5.3
        CFLAGS = 
    GSSAPI:
        LIBS   = -L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-Bsymbolic-functions -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
        CFLAGS = -isystem /usr/include/mit-krb5
    ZEROCONF:
        LIBS   =  -lavahi-common -lavahi-client
        CFLAGS =  -D_REENTRANT
    LDAP:
        LIBS   =  -lldap
        CFLAGS = 
    LIBEVENT:
        LIBS   = 
        CFLAGS = 
    TDB:
        LIBS   = -ltdb
        CFLAGS = 
    MySQL:
        LIBS   = -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl
        CFLAGS = -I/usr/include/mysql 
Configure summary:
    INIT STYLE:
         debian-systemd
    AFP:
         Extended Attributes: ad | sys
         ACL support: yes
         Spotlight: yes
    CNID:
         backends:  dbd last tdb mysql
    UAMS:
         DHX     (PAM SHADOW)
         DHX2    (PAM SHADOW)
         RANDNUM (afppasswd)
         Kerberos V
         clrtxt  (PAM SHADOW)
         guest
    Options:
         Zeroconf support:        yes
         tcp wrapper support:     yes
         quota support:           yes
         valid shell check:       yes
         cracklib support:        yes
         ACL support:             auto
         Kerberos support:        yes
         LDAP support:            yes
         AFP stats via dbus:      yes
         dtrace probes:           yes
    Paths:
         Netatalk lockfile:       /var/lock/netatalk
         init directory:          /lib/systemd/system
         dbus system directory:   /etc/dbus-1/system.d
         dbus daemon path:        /usr/bin/dbus-daemon
         tracker prefix:          /usr
         tracker install prefix:  /usr
         tracker manager:         /usr/bin/tracker daemon
         pam config directory:    /etc/pam.d
    Documentation:
         Docbook:                 no

正式编译

make -j4
sudo make install

检测是否安装正常

$ /usr/local/sbin/netatalk -V
netatalk 3.1.12 - Netatalk AFP server service controller daemon

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. Please see the file COPYING for further information and details.

netatalk has been compiled with support for these features:

      Zeroconf support: Avahi
     Spotlight support: Yes

                  afpd: /usr/local/sbin/afpd
            cnid_metad: /usr/local/sbin/cnid_metad
       tracker manager: /usr/bin/tracker daemon
           dbus-daemon: /usr/bin/dbus-daemon
              afp.conf: /usr/local/etc/afp.conf
     dbus-session.conf: /usr/local/etc/dbus-session.conf
    netatalk lock file: /var/lock/netatalk
$ /usr/local/sbin/afpd -V
afpd 3.1.12 - Apple Filing Protocol (AFP) daemon of Netatalk

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. Please see the file COPYING for further information and details.

afpd has been compiled with support for these features:

          AFP versions: 2.2 3.0 3.1 3.2 3.3 3.4 
         CNID backends: dbd last tdb mysql 
      Zeroconf support: Avahi
  TCP wrappers support: Yes
         Quota support: Yes
   Admin group support: Yes
    Valid shell checks: Yes
      cracklib support: Yes
            EA support: ad | sys
           ACL support: Yes
          LDAP support: Yes
         D-Bus support: Yes
     Spotlight support: Yes
         DTrace probes: Yes

              afp.conf: /usr/local/etc/afp.conf
           extmap.conf: /usr/local/etc/extmap.conf
       state directory: /usr/local/var/netatalk/
    afp_signature.conf: /usr/local/var/netatalk/afp_signature.conf
      afp_voluuid.conf: /usr/local/var/netatalk/afp_voluuid.conf
       UAM search path: /usr/local/lib/netatalk//
  Server messages path: /usr/local/var/netatalk/msg/