Friday, July 20, 2012

Replacing WHS 2011 with Ubuntu Server 12.04 (Part 4 - Install and configure Netatalk)

One of my primary goals with this conversion is to allow my MacBook with 10.7 to use the home server as a time machine backup destination. Since Apple nerfed the ability to hack time machine into a SMB share I've been looking for a way to get netatalk on this hardware.

I found a few guides for installing netatalk on Ubuntu server, and while this was the best I wound up combining information from a number of places and a little trial and error in a virtual machine before settling on the steps.

  1. First we need to install netatalk and avahi-daemon. The first provides the actual afp daemon and the second the bonjour daemon to allow the MacBook to see the afp shares.
    $ sudo apt-get install netatalk avahi-daemon 
  2. Once installed, configure the netatalk daemon by editing /etc/default/netatalk
    $ sudo nano /etc/default/netatalk
    Ensure that the following options are set:
    ATALKD_RUN=no
    PAPD_RUN=no
    CNID_METAD_RUN=yes
    AFPD_RUN=yes
    TIMELORD_RUN=no
    A2BOOT_RUN=no
  3. Next modify the netatalk shares by editing /etc/netatalk/AppleVolumes.default
    $ sudo nano /etc/netatalk/AppleVolumes.default
    Add "tm" to the default options line:
    DEFAULT: options:tm,upriv,usedots
    And add a line similar to the following to create the Time Machine share. User home directories are shared by default as well but I find having a single share for time machine bundles it more manageble:
    /data/backup/TimeMachine "Time Machine" cnidscheme:dbd allow:@timemachine
  4. Before we forget we should create the timemachine group and folder.
    $ sudo addgroup timemachine
    $ sudo adduser timemachine
    $ sudo mkdir /data/local/backups/timemachine
    $ sudo chgrp timemachine /data/local/backups/timemachine
    $ sudo chmod 775 /data/local/backups/timemachine
  5. Lastly we need to configure avahi. This is done by creating /etc/avahi/services/afpd.service and adding the following XML code:
    $ sudo nano /etc/avahi/services/afpd.service


        %h
       
            _afpovertcp._tcp
            548
       
       
            _device-info._tcp
            0
            model=Xserve
       
  6. Restart netatalk and avahi and test in Finder
    $ sudo /etc/init.d/netatalk restart
    $ sudo service avahi-daemon reload
Next stop, samba...

EDIT: I did find it helped to set the group ownership on the shared folder to something like "users" or "staff" and set the permissions to 2775 to allow the group ownership to automatically propagate to new files added.

No comments: