Backing up using Time Machine to an Ubuntu server

Hello!

I decided last night that I wanted to get a couple of Apple things working on my network. I want to backup my MacBook Pro with Time Machine on to an Ubuntu Server. And I want AirPrint working with my shared printer.

In order to get Time Machine working I need an AFP share (I’m actually pretty sure you can also use a samba share but I went the whole hog) on the Ubuntu Server (which is version 10.10).

Step 1: Install Netatalk

 sudo aptitude install netatalk

Step 2: Configure Netatalk

I should state that I’m configuring this for OS X 10.6.6 for older version you’ll want to check Netatalk man pages for instructions on enabling the AppleTalk protocol

 sudo nano /etc/default/netatalk

I found that when I went to edit this file it was already set as required for my environment

 ATALKD_RUN=no
 PAPD_RUN=no
 CNID_METAD_RUN=yes
 AFPD_RUN=yes
 TIMELORD_RUN=no
 A2BOOT_RUN=no

Save and exit the file (CTRL+O then enter, CTRL+X) now it’s time to edit afpd.conf

 sudo nano /etc/netatalk/afpd.conf

Scroll to the very bottom and ensure the line looks like the following

 - -transall -uamlist uams_randnum.so,uams_dhx.so -nosavepassword -advertise_ssh -nozeroconf

Save and close the file then restart netatalk

 sudo /etc/init.d/netatalk restart

Netatalk has not yet been converted to upstart so old method for now.

Alright, almost done with Netatalk, time to setup the shared folder for Time Machine.

 sudo nano /etc/netatalk/AppleVolumes.default

Scroll to the bottom of the file and define your share as follows

 /home/username/TimeMachine TimeMachine allow:username1,username2 options:usedots,upriv

Save and exit the file, then restart netatalk again. On to Zeroconf setup now.

Step 3: Install Avahi

Avahi is the open source implentation of Apple’s Bonjour Zeroconf program.

 sudo aptitude install avahi-daemon
 sudo aptitude install libnss-mds

Now a quick modification to the nsswitch.conf file

 sudo nano /etc/nsswitch.conf

Find the line starting with “hosts” and add mdns to the end of it, the line should look as below

 hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns

Save and exit the file. Job done here.

Step 4: Configuring Avahi

Next stage is to create the service so

 sudo nano /etc/avahi/services/afpd.service

Paste in the following

 <?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>

Save and exit then restart avahi

 sudo restart avahi-daemon

Step 5: Enable Unsupported Network drives on your Mac

On your Mac open a terminal window and enter the following

 defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

This same code is what lets it see samba shares but I’ve not tried backing up to a samba share with Time Machine.

Now you’re pretty much done, just fire up the Time Machine app and look for your ubuntu server in the list of available disks.

This was adapted from the following two articles and their comments:

http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/
http://gpz500.wordpress.com/2008/09/27/lairone-al-servizio-del-leopardo/

Next time, I’ll go over how I got AirPrint working, it’s very easy if you’ve done the above already.

2 thoughts on “Backing up using Time Machine to an Ubuntu server”

  1. 1) Yes since July 2009 🙂
    2) I have Windows running on Fusion but I use OSX most of the time in an effort to broaden my expertise

Comments are closed.