Raspberry Pi as TimeCapsule

  • Use Etcher to create disk; Raspbian Jessie Lite
  • Boot rpi
  • change password
  • enable ssh: touch /boot/ssh
  • reboot rpi
  • copy ssh key:
    cat ~/.ssh/id_rsa.pub | ssh pi@[x.x.x.x] "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys
    
  • disable ssh password login (only allow pubkey)
  • enable locales (en_US.UTF-8):
    sudo -s dpkg-reconfigure locales
    
  • install prerequisites for netatalk:
    sudo apt install htop build-essential libevent-dev libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libtdb-dev 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-1.0-dev libtracker-miner-1.0-dev
    
  • wget https://netcologne.dl.sourceforge.net/project/netatalk/netatalk/3.1.10/netatalk-3.1.10.tar.bz2
    
  • ./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=1.0
    
  • make and make install

  • /etc/nsswitch.conf — add mdns4 mdns
    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns
    
  • edit /etc/avahi/services/afpd.service:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
    <name replace-wildcards="yes">%h</name>
    <service>
        <type>_afpovertcp._tcp</type>
        <port>548</port>
    </service>
    <service>
        <type>_device-info._tcp</type>
        <port>0</port>
        <txt-record>model=Xserve</txt-record>
    </service>
</service-group>
  • edit /etc/fstab — add:
    /dev/sda1   /media/buffalo  ext4  defaults  0 2
    
  • edit /usr/local/etc/afp.conf:
;
; Netatalk 3.x configuration file
;

[Global]
; Global server settings
mimic model = TimeCapsule6,106

; [Homes]
; basedir regex = /xxxx

; [My AFP Volume]
; path = /path/to/volume

[Raspberry Time Machine]
path = /media/buffalo
time machine = yes
  • sudo systemctl enable avahi-daemon
  • sudo systemctl enable netatalk
  • sudo systemctl start avahi-daemon
  • sudo systemctl start netatalk

Tags:

Categories:

Updated:

Comments