Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install netatalk (afp) in Ubuntu with service announcing and provide a Time Machine share. Users must belong to `timemachine` group to be allowed to use it.
[TimeMachine]
path = /store/time-machine
time machine = yes
valid users = @timemachine
#!/bin/bash
# This script will install the latest stable version of netatalk 3.x and libevent in order
# to configure a Time machine volume
# Versions to use
libevent_version="2.0.22-stable"
netatalk_version="3-1-7"
# Install prerequisites:
apt-get install build-essential pkg-config checkinstall git avahi-daemon libavahi-client-dev libcrack2-dev libwrap0-dev autotools-dev automake libtool libdb-dev libacl1-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev libtdb-dev
# libevent
cd /usr/local/src
wget http://skylink.dl.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-${libevent_version}.tar.gz
tar xfv libevent-${libevent_version}.tar.gz
cd libevent-${libevent_version}
./configure
make
checkinstall \
--pkgname=libevent-${libevent_version} \
--pkgversion=${libevent_version} \
--backup=no \
--deldoc=yes \
--default --fstrans=no
cd ../
# netatalk
git clone git://git.code.sf.net/p/netatalk/code netatalk-code
cd netatalk-code
git checkout netatalk-${netatalk_version}
./bootstrap
./configure \
--enable-debian \
--enable-krbV-uam \
--enable-zeroconf \
--enable-krbV-uam \
--enable-tcp-wrappers \
--with-cracklib \
--with-acls \
--with-dbus-sysconf-dir=/etc/dbus-1/system.d \
--with-init-style=debian-sysv \
--with-pam-confdir=/etc/pam.d \
--with-tracker-pkgconfig-version=0.16
make
checkinstall \
--pkgname=netatalk \
--pkgversion=${netatalk_version} \
--backup=no \
--deldoc=yes \
--default \
--fstrans=no
# Install time machine configuration
cp afp.conf /usr/local/etc/
# Start services
service avahi-daemon start
service netatalk start
# Instruct User
echo "************************************"
echo "* INSTALLATION COMPLETE *"
echo "************************************"
echo " To add users to your Time Machine symply"
echo " simadd them to the timemachine group by"
echo " running the following command as root:"
echo " sudo usermod -a -G timemachine <username>"
echo " Afterwards they can log in the Time Machine"
echo " volume with their linux user and password"
echo "------------------------------------"
echo " CONFIG FILE: /usr/local/etc/afp.conf"
@dinigo
Copy link
Author

dinigo commented Feb 8, 2015

fixed several typos and fixed lib event download link, thanks to @odarriba

@d2s
Copy link

d2s commented May 15, 2016

Had to modify the original install script since it lacked some of the required packages.

Modifications:
https://gist.github.com/d2s/ad86d51173a6b05d54e785f16d8ea69f/revisions

  • Add missing libtool-bin libkrb5-dev packages so that compiling works.
  • Update libgcrypt11 libgcrypt11-dev to libgcrypt20 libgcrypt20-dev version since old one was removed from Ubuntu 16.04 packages.
  • Update libevent download path from SourceForge to GitHub because the URL was not responding anymore.
  • Disable (comment out) cp afp.conf /usr/local/etc/ because it failed the install script because script is at different directory when it is run (because cd netatalk-code had moved it to that location, away from the original afp.conf disk location).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment