Ubuntu 12.04 + OSX Time Machine

I think I have covered this in an old post, but I just fixed some things that have been bugging me. The first referenced article at the bottom was a huge help in getting me started, but he has a lot of malformed xml tags. He also creates 3 files, which I've found you do not need, just create one.

Ok, first install netatalk and avahi.
sudo apt-get install netatalk avahi-daemon

Now let's create and edit our new avahi service
sudo nano /etc/avahi/services/afp.service

<?xml version="1.0" standalone='no'?>
<!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>548</port>
        <txt-record>model=Xserve</txt-record>
    </service>
    <service>
        <type>_adisk._tcp</type>
        <port>9</port>
        <txt-record>sys=waMA=MM:MM:MM:MM:MM:MM</txt-record>
        <txt-record>dk0=adVF=0x81,adVN=TimeMachine,adVU=UUUU</txt-record>
    </service>
</service-group>
If you are running Samba on this server as well, you might want to change the <name> field. I have changed mine to <name>timelord</name>. This will allow your timemachine/apple shares to coexist on the same server (it will look like a different server in Finder though)
MM:MM:MM:MM:MM:MM should be the MAC address of your Ubuntu server. You can quickly find it by running the following command.
ifconfig -a | grep HWaddr
UUUU needs to be a unique UUID. Go to guidgen.com to generate a UUID. Now save the file, and let's move on.

Create some directories and a new user:
sudo mkdir -p /mnt/timemachine

sudo useradd -c "Time Machine User" -d /mnt/timemachine/ -s /bin/false -g 10 timemachine

sudo passwd timemachine

Set your timemachine share so it is supported:
sudo touch /mnt/timemachine/.com.apple.timemachine.supported

Set some ACLs:
sudo chown -R timemachine:users /mnt/timemachine

Next we move to setting up two files for netatalk:
sudo nano /etc/netatalk/afpd.conf

at the very bottom of the file, add:
- -tcp -nozeroconf
This tells netatalk to use tcp and not use zeroconf, if you don't use this then you will get two enties in Finder.

Configure your /etc/netatalk/AppleVolumes.default file:
# By default all users have access to their home directories.
#~/                      "Home Directory"
/mnt/timemachine "TimeMachine" allow:timemachine options:tm
# End of File

Now restart your services, and you should be done:
sudo service netatalk restart

sudo service avahi-daemon restart

References:
http://www.64bit.co.uk/index.php/archives/261
http://blog.scottlowe.org/2009/01/02/ubuntu-and-mac-os-x-integration/
http://derekingrouville.ca/2011/ubuntu-time-machine-server-for-osx-lion/
http://www.bootc.net/archives/2010/11/07/apple-time-machine-and-netatalk/
http://netatalk.sourceforge.net/wiki/index.php/Bonjour_record_adisk_adVF_values
Time Machine Server Requirements