Skip to content

Instantly share code, notes, and snippets.

@kelvinq
Forked from agrlh/install_netatalk_debian.md
Last active February 11, 2017 20:52
Show Gist options
  • Save kelvinq/f300c91d7de407b54d5c to your computer and use it in GitHub Desktop.
Save kelvinq/f300c91d7de407b54d5c to your computer and use it in GitHub Desktop.

Revisions

  1. kelvinq revised this gist Dec 25, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install_netatalk_debian.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    # Building and setting up netatalk 3.1.2 on Debian
    # Building and setting up netatalk 3.1.2 on Debian Jessie 8.0

    ## 1. Build

    ### Install dependencies

    sudo apt-get install automake libtool build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libssl-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev libcrack2-dev libpam0g-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libwrap0-dev systemtap-sdt-dev libacl1-dev libldap2-dev
    apt-get install automake libtool build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libssl-dev libdb5.3-dev db-util db5.1-util libgcrypt20 libgcrypt-dev libcrack2-dev libpam0g-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libwrap0-dev systemtap-sdt-dev libacl1-dev libldap2-dev

    ### Download and unpack netatalk 3.1.2

  2. Alex revised this gist Jun 15, 2014. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions install_netatalk_debian.md
    Original file line number Diff line number Diff line change
    @@ -115,17 +115,17 @@ The configuration file is found under `/usr/local/etc/afp.conf`. Make sure to cr
    valid users = @backup

    [TimeMachine A]
    ; Time Machine folder for user A, that only he can access
    ; Time Machine folder for user A - limited to 400GB
    path = /mnt/Backup/TM-userA
    valid users = userA
    vol size limit = 409600
    vol size limit = 381470
    time machine = yes

    [TimeMachine B]
    ; Time Machine folder for user B, that only he can access
    ; Time Machine folder for user B - limited to 200GB
    path = /mnt/Backup/TM-userB
    valid users = userB
    vol size limit = 204800
    vol size limit = 190735
    time machine = yes

    Restart netatalk
  3. Alex revised this gist Jun 15, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_netatalk_debian.md
    Original file line number Diff line number Diff line change
    @@ -102,7 +102,7 @@ The configuration file is found under `/usr/local/etc/afp.conf`. Make sure to cr
    ; Global configuration
    hostname = Backup
    log file = /var/log/netatalk.log
    log leve = default:info
    log level = default:info
    zeroconf = yes
    valid users = @backup
    save password = yes
  4. Alex created this gist Jun 6, 2014.
    175 changes: 175 additions & 0 deletions install_netatalk_debian.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,175 @@
    # Building and setting up netatalk 3.1.2 on Debian

    ## 1. Build

    ### Install dependencies

    sudo apt-get install automake libtool build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libssl-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev libcrack2-dev libpam0g-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libwrap0-dev systemtap-sdt-dev libacl1-dev libldap2-dev

    ### Download and unpack netatalk 3.1.2

    wget http://downloads.sourceforge.net/project/netatalk/netatalk/3.1.2/netatalk-3.1.2.tar.bz2
    tar xvf netatalk-3.1.2.tar.bz2

    ### Configure and make

    cd netatalk-3.1.2
    ./configure --with-init-style=debian --with-zeroconf --with-cracklib --with-pam-confdir=/etc/pam.d --with-dbus-sysconf-dir=/etc/dbus-1/system.d

    After successfull configuration the configure summary should look like this

    Configure summary:
    INIT STYLE:
    debian
    AFP:
    Extended Attributes: ad | sys
    ACL support: yes
    Spotlight: no
    CNID:
    backends: dbd last tdb
    UAMS:
    DHX (PAM SHADOW)
    DHX2 (PAM SHADOW)
    RANDNUM (afppasswd)
    clrtxt (PAM SHADOW)
    guest
    Options:
    Zeroconf support: yes
    tcp wrapper support: yes
    quota support: yes
    admin group support: yes
    valid shell check: yes
    cracklib support: yes
    ACL support: auto
    Kerberos support: auto
    LDAP support: yes
    AFP stats via dbus: yes
    dtrace probes: yes
    Paths:
    Netatalk lockfile: /var/lock/netatalk
    init directory: /etc/init.d
    dbus system directory: /etc/dbus-1/system.d
    pam config directory: /etc/pam.d
    Documentation:
    Docbook: no

    make

    ### Install
    Use the option `--fstrans=no` to prevent failing of `mkdir -p` commands during the install.

    sudo checkinstall --fstrans=no


    ## 2. Setup

    ### Install HFS packages
    I am using a USB HDD, which was formatted on my Mac as a HFS+ (journaled) volume. In order to mount and use this drive we have to install the necessary HFS packages:

    sudo apt-get install hfsplus hfsutils hfsprogs

    ### Mount the drive
    Create the mount destination folder

    sudo mkdir /mnt/Backup

    Get the drive's UUID

    sudo blkid

    Add the drive to `/etc/fstab`

    UUID=<UUID from blkid> /mnt/Backup hfsplus force,defaults 0 0

    Mount it

    sudo mount /mnt/Backup

    Set appropriate permissions

    sudo chown backup:backup /mnt/Backup
    sudo chmod 2775 /mnt/Backup

    ### Netatalk configuration file

    The configuration file is found under `/usr/local/etc/afp.conf`. Make sure to create the folders specified in the path of each volume.

    ;
    ; Netatalk 3.x configuration file
    ;

    [Global]
    ; Global configuration
    hostname = Backup
    log file = /var/log/netatalk.log
    log leve = default:info
    zeroconf = yes
    valid users = @backup
    save password = yes
    mimic model = TimeCapsule
    hosts allow = 192.168.178.0/24

    [Backup]
    ; Backup folder for every user in group 'backup'
    path = /mnt/Backup/Backup
    valid users = @backup

    [TimeMachine A]
    ; Time Machine folder for user A, that only he can access
    path = /mnt/Backup/TM-userA
    valid users = userA
    vol size limit = 409600
    time machine = yes

    [TimeMachine B]
    ; Time Machine folder for user B, that only he can access
    path = /mnt/Backup/TM-userB
    valid users = userB
    vol size limit = 204800
    time machine = yes

    Restart netatalk

    sudo service netatalk restart

    ## Autostart script

    #!/bin/bash
    ### BEGIN INIT INFO
    # Provides: TimeMachine
    # Required-Start:
    # Required-Stop:
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start TimeMachine.
    # Description: Enable TimeMachine service and mount the drive.
    ### END INIT INFO

    DUUID="<UUID from blkid>"
    MNTP="/mnt/Backup"

    if [ "$(id -u)" != "0" ]; then
    echo "This script must be run as root" 1>&2
    exit 1
    fi
    case "$1" in
    start)
    service netatalk stop
    service avahi-daemon stop
    umount -l $MNTP
    sudo fsck.hfsplus -f `blkid -U $DUUID`
    mount -t hfsplus -o force `blkid -U $DUUID` $MNTP
    service avahi-daemon start
    service netatalk start
    ;;
    stop)
    service netatalk stop
    service avahi-daemon stop
    umount -l $MNTP
    ;;
    *)
    echo "Usage: /etc/init.d/TimeMachine {start|stop}"
    exit 1
    ;;
    esac
    exit 0