# Installation

If you have previously used an older version of Netatalk, please read the chapter about upgrading first !!!

## How to obtain Netatalk

Please have a look at the Netatalk page on GitHub for the most recent information on this matter.

https://github.com/Netatalk/netatalk

### Binary packages

Binary packages of Netatalk are included in some Linux and UNIX distributions. You might want to have a look at the usual locations, too.

Ubuntu packages: https://launchpad.net/ubuntu

Debian packages: https://www.debian.org/

various RPM packages: http://rpmfind.net/

Fedora/RHEL packages: http://koji.fedoraproject.org/koji/search

Gentoo packages: http://packages.gentoo.org/

openSUSE packages: http://software.opensuse.org/

Solaris packages: http://www.opencsw.org/

FreeBSD ports: http://www.freebsd.org/ports/index.html

NetBSD pkgsrc: http://pkgsrc.se/search.php

OpenBSD ports:https://openports.pl

etc.

### Source packages

#### Tarballs

Prepackaged tarballs in .tar.gz and .tar.bz2 format are available on the Netatalk page on GitHub.

#### Git

Downloading the Git repository can be done quickly and easily:

1. Make sure you have Git installed. `which git` should produce a path to git.

       $ which git
       /usr/bin/git

2. Now get the source:

       $ git clone https://github.com/Netatalk/netatalk.git netatalk-code
       Initialized empty Git repository in /path/to/new/source/dir/netatalk/.git/
       remote: Counting objects: 2503, done.
       ...

   This will create a local directory called `netatalk-code` containing a complete and fresh copy of the whole Netatalk source from the Git repository.

3. In order to keep your repository copy updated, occasionally run:

       $ git pull

4. Now `cd` to the netatalk-code directory and run `./bootstrap`. This will create the `configure` script required in the next step.

       $ ./bootstrap

For futher information refer to the Developer Notes wiki page.

## Compiling Netatalk

### Prerequisites

The following pieces of software are likely to have a package available for your OS distribution of choice.

Please see the Installation Notes wiki page as a starting point.

#### Required third-party software

- Berkeley DB
  .

  At the time of writing you need at least version 4.6.

  The recommended version is 5.3, which was the final release under the permissive Sleepycat license, which means that this is what most FLOSS operating systems are defaulting to.

- Libgcrypt

  The Libgcrypt library enables the DHX2 UAM, which is required to authenticate with OS X 10.7 and later.

#### Optional third-party software

Netatalk can use the following third-party software to enhance its functionality.

- Tracker for Spotlight
  support

  Netatalk uses Tracker as the metadata backend. Recent Linux distributions will provide the libtracker-sparql library which is available since Tracker version 0.7.

- mDNSresponderPOSIX or Avahi for Bonjour (aka Zeroconf)

  Mac OS X 10.2 and later use Bonjour (aka Zeroconf) for service discovery.

  The Avahi library must be built with DBUS support ( `--enable-dbus`).

- TCP wrappers

  Wietse Venema's network logger, also known as TCPD or LOG_TCP.

  Security options are: access control per host, domain and/or service; detection of host name spoofing or host address spoofing; booby traps to implement an early-warning system.

- PAM

  PAM provides a flexible mechanism for authenticating users. PAM was invented by SUN
  Microsystems. Linux-PAM is a suite of shared libraries that enable the local system administrator to choose how applications authenticate users.

- iconv

  iconv provides conversion routines for many character encodings. Netatalk uses it to provide charsets it does not have built in conversions for, like ISO-8859-1. On glibc systems, Netatalk can use the glibc provided iconv implementation. Otherwise you can use the GNU libiconv implementation.

### Compiling
Netatalk

#### Configuring the build

To build the binaries, first run the program `./configure` in the source directory. This should automatically configure Netatalk for your operating system. If you have unusual needs, then you may wish to run

    $ ./configure --help

to see what special options you can enable.

The most used configure options are:

- `--with-init-style`=redhat-sysv|redhat-systemd|suse-sysv|suse-systemd|gentoo-openrc|gentoo-systemd|netbsd|debian-sysv|debian-systemd|solaris|openrc|systemd|macos-launchd

  This option helps Netatalk to determine where to install the start scripts.

- `--with-bdb`=`/path/to/bdb/installation/`

  In case you installed Berkeley DB in a non-standard location, you will have to give the install location to Netatalk, using this switch.

- `--with-ssl-dir`=`/path/to/ssl/installation/`

  In case you installed OpenSSL or LibreSSL in a non-standard location, you will have to give the install location to Netatalk, using this switch.

Now run configure with any options you need

    $ ./configure [arguments]

Configure will end up in an overview showing the settings the Netatalk Makefiles have been created with.

#### Spotlight

Netatalk uses Gnome Tracker as the metadata backend. The minimum required version is 0.7 as that's the first version to support SPARQL.

If not already installed, install the packages tracker and tracker-devel, on Solaris install OpenCSW and then install the Tracker package from the OpenCSW unstable repository.

The tracker packages are found via pkg-config, you may have to pass the version suffix as you may have a newer version installed then the default 0.12, e.g.

    $ pkg-config --list-all | grep tracker
    	tracker-sparql-3.0             tracker-sparql-3.0 - Tracker : A SPARQL triple store library

So in this example, configure with:

    $ ./configure --with-tracker-pkgconfig-version=3.0 ...

If you're using Solaris and Tracker from OpenCSW, then you need to set the PKG_CONFIG_PATH environment variable, add the --with-tracker-prefix configure option and add LDFLAGS="-R/opt/csw/lib"

    PKG_CONFIG_PATH=/opt/csw/lib/pkgconfig LDFLAGS="-R/opt/csw/lib" ./configure --with-tracker-prefix=/opt/csw --with-tracker-pkgconfig-version=0.16 ...

Check the configure output whether the Tracker libs were found:

    checking for TRACKER... yes
            checking for TRACKER_MINER... yes
            ...
            Configure summary:
            ...
              AFP:
                Spotlight: yes
            ...

#### Compile and install

Next, running

    $ make

should produce the Netatalk binaries (this step can take several minutes to complete).

When the process finished you can use

    $ make install

to install the binaries and documentation (must be done as "root" when using default locations).