A Digital Age Deserves A Digital Leader

Configuring Ubuntu to Store Time Machine Backups

Configuring Ubuntu to Store Time Machine Backups

Postby gries818 » Sun Jul 12, 2009 4:51 am

Configuring Ubuntu to Store Time Machine Backups

Created/Updated: 01.24.11
Tested With: Ubuntu 11.04, Mac OS 10.6.7

Contents
  • Introduction
  • Installation
  • Configuring Netatalk
  • Configuring Avahi
  • Configuring your Mac

Introduction

There are a number of ways to get Time Machine to backup to a Linux, and while theoretically it is possible to use a Samba share, the best way to do it is to setup Linux (in this case Ubuntu 9.04) to work as a Mac server to OS X.

This guide will walk you through, step-by-step, to install the open-source implementation of the Apple Filing Protocol (AFP), which is what allows Macs (or in this case other UNIX-like OS) to share services across a network.

This guide uses the Command-line based text editor nano. If you would prefer to use another editor (such as vim) simply replace nano with your chosen editor in the given commands. Alternatively, if you are running the Desktop version of Ubuntu 9.04, it might be easiest to replace nano with gedit, a graphical based text editor.

After you are finished editing each file with nano, you must save your changes with Control+X. You must use the control key, even if you are remotely editing (via ssh or similar service) on a Mac.

It is recommended that before following the setup in the rest of the guide, that you run these commands to ensure that your Ubuntu installation is up-to-date. NOTE: Everything after the ‘#’ is a comment, and does not need to be copied into the Terminal.

Code: Select all
sudo apt-get update #Refreshes Ubuntu Repositories
sudo apt-get upgrade #Downloads and installs new updates
sudo apt-get autoclean #Deletes unneeded installation files


Installation

Installing AFP on Ubuntu (or any other UNIX-like OS) requires one basic open-source package (plus other prerequisite packages):
  • Netatalk - contains the actual implementation of AFP
  • Avahi – broadcasts server’s presence across LAN to allow OS X to access them

These commands to install the proper packages (requires internet connection):

Code: Select all
sudo apt-get install netatalk avahi-daemon


Configuring Netatalk

Once all of the needed packages are installed, you will need to configure Netatalk to work properly. Run:

Code: Select all
sudo nano /etc/default/netatalk


Scroll to the bottom of the file and under the “# Set which aemons to run (papd is dependent upon atalkd):” change your configuration to match the following:

Code: Select all
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no


These commands will prevent unneeded services from starting at boot, causing your machine to boot much quicker.

Next open afpd.conf,

Code: Select all
sudo nano /etc/netatalk/afpd.conf


and append the following line to the end of the file:

Code: Select all
- -transall -uamlist uams_randnum.so,uams_dhx2.so -nosavepassword -advertise_ssh


Finally, you will need to tell Netatalk what to share as a Volume. Open up the AppleVolumes.default file with

Code: Select all
sudo nano /etc/netatalk/AppleVolumes.default


Comment out all lines (put a '#' at the beginning of the line) and add this to the end of the file (if the volume you want to share is /media/backup and the username you want to use with Time Machine is gries818):

Code: Select all
/media/backup Backup allow:gries818 cnidscheme:dbd options:tm


Additional lines can be added to give access to different folders on the Ubuntu machine.

Restart netatalk with:

Code: Select all
sudo /etc/init.d/netatalk restart


Configuring Avahi

Netatalk can be used without any further configuration, but in order to get the server in the "Shared" section in the Finder window, you need to configure Avahi (which is basically an open implementation of Apple's Bonjour service).

First, edit nsswitch.conf with

Code: Select all
sudo nano /etc/nsswitch.conf


and add mdns to the end of the line that starts with "hosts:".

Next, will need to create a new file for Avahi so it knows what services to broadcasts to the Macs on your network.

Code: Select all
sudo nano /etc/avahi/services/afpd.service


And copy this xml data into the file:

Code: Select all
<?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=MacPro</txt-record>
</service>
</service-group>


This will make your server display itself as a MacPro, but you can make it display as any type of a Mac you want by substituting the model=MacPro with the desired model:

  • iMac
  • MacPro
  • MacBook
  • MacBookPro
  • MacBookAir
  • PowerBook
  • PowerMac
  • Macmini
  • Xserve
  • AirPort

Now, simply restart Avahi to make Finder aware of the new services available on your Ubuntu machine.

Code: Select all
sudo service avahi-daemon restart


Configuring your Mac

Finally, to use TimeMachine with your Ubuntu setup you need to override the default TimeMachine settings on your Mac. Open up the Terminal (/Applications/Utilities/Terminal.app) and type:

Code: Select all
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1


Your new Shared Volume will now available in the TimeMachine disk selection.

Conclusion

If you have any problems with this tutorial be sure to ask... not every setup will yield the same results. Additionally, this should work with any Linux OS, provide you make adjustments for the different package managers (apt is Ubuntu's package manager).
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby gries818 » Thu Jan 13, 2011 4:23 am

I've updated this with some new improvements I've since found, but otherwise this still works perfectly with the newest versions of Ubuntu and OS X ^*^
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby CharlesSaint007 » Tue Jan 25, 2011 3:35 am

Hey there, just an FYI, the dropbox link appears to be dead ( http://dl.getdropbox.com/u/187424/netat ... 0_i386.deb ). I believe the links generated in Dropbox are only good for 30 days, which may be the issue. Either way, I'm getting a 404 error when trying to access the link.
PRO New Member
Posts: 1
Joined: Tue Jan 25, 2011 3:31 am

Re: Configuring Ubuntu to Store Time Machine Backups

Postby gries818 » Tue Jan 25, 2011 4:09 am

Thanks for tipping me off one of the links no longer worked, I've fixed it now. To my knowledge, everything thing should be working again.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby jaxon » Wed Jan 26, 2011 7:54 pm

Hi there. Thanks a lot for the tutorial and the time you put into it!
I'm trying to replicate it on a clean install of Ubuntu 10.10. I've followed each step to the T but can;'t get past:
Code: Select all
sudo dpkg -i netatalk_2.0.3-brando0_i386.deb


It's giving me this output:
jaxon@server:~$ sudo dpkg -i netatalk_2.0.3-brando0_i386.deb
Selecting previously deselected package netatalk.
(Reading database ... 150026 files and directories currently installed.)
Unpacking netatalk (from netatalk_2.0.3-brando0_i386.deb) ...
dpkg: dependency problems prevent configuration of netatalk:
netatalk depends on libcupsys2 (>= 1.3.4); however:
Package libcupsys2 is not installed.
netatalk depends on libdb4.6; however:
Package libdb4.6 is not installed.
netatalk depends on libgnutls13 (>= 2.0.4-0); however:
Package libgnutls13 is not installed.
netatalk depends on libkrb53 (>= 1.6.dfsg.2); however:
Package libkrb53 is not installed.
dpkg: error processing netatalk (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Errors were encountered while processing:
netatalk


Thanks in advance!
PRO New Member
Posts: 6
Joined: Wed Jan 26, 2011 7:43 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby gries818 » Wed Jan 26, 2011 8:17 pm

jaxon wrote:Hi there. Thanks a lot for the tutorial and the time you put into it!
I'm trying to replicate it on a clean install of Ubuntu 10.10. I've followed each step to the T but can;'t get past:
Code: Select all
sudo dpkg -i netatalk_2.0.3-brando0_i386.deb


It's giving me this output:
jaxon@server:~$ sudo dpkg -i netatalk_2.0.3-brando0_i386.deb
Selecting previously deselected package netatalk.
(Reading database ... 150026 files and directories currently installed.)
Unpacking netatalk (from netatalk_2.0.3-brando0_i386.deb) ...
dpkg: dependency problems prevent configuration of netatalk:
netatalk depends on libcupsys2 (>= 1.3.4); however:
Package libcupsys2 is not installed.
netatalk depends on libdb4.6; however:
Package libdb4.6 is not installed.
netatalk depends on libgnutls13 (>= 2.0.4-0); however:
Package libgnutls13 is not installed.
netatalk depends on libkrb53 (>= 1.6.dfsg.2); however:
Package libkrb53 is not installed.
dpkg: error processing netatalk (--install):
dependency problems - leaving unconfigured
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Errors were encountered while processing:
netatalk


Thanks in advance!


Looks like you are having dependency problems install the .deb (which is just a binary installer, like .exe). You need to be sure you've run this command before you install the netatalk .deb:

Code: Select all
sudo apt-get build-dep netatalk


Post back if you've already done that and it still doesn't work.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby jaxon » Wed Jan 26, 2011 8:35 pm

oops wrong one. hold up...

Code: Select all
jaxon@server:~$     sudo apt-get build-dep netatalk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
PRO New Member
Posts: 6
Joined: Wed Jan 26, 2011 7:43 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby gries818 » Wed Jan 26, 2011 8:48 pm

Hmm, that is weird. Well you could try manually installing all the dependencies it tells you that you need when you try to run:

Code: Select all
sudo dpkg -i netatalk_2.0.3-brando0_i386.deb


Before we do that do, out of vain curiosity, do you have build-essential installed? I wonder if that is the problem, I'll give you instructions on how to install the dependencies if that doesn't work.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby jaxon » Wed Jan 26, 2011 8:59 pm

thanks again for the quick response. I am assuming that because I do not know what build-essential is, I do not have it installed - however you know what they say about assumptions... or is that assuming?

Help with installing those dependencies would be great. Thanks!
PRO New Member
Posts: 6
Joined: Wed Jan 26, 2011 7:43 pm

Re: Configuring Ubuntu to Store Time Machine Backups

Postby gries818 » Wed Jan 26, 2011 9:04 pm

jaxon wrote:thanks again for the quick response. I am assuming that because I do not know what build-essential is, I do not have it installed - however you know what they say about assumptions... or is that assuming?

Help with installing those dependencies would be great. Thanks!


Build-essential is a package of a software related to building software from source. I recommended any Ubuntu user installing it, because once you start doing more advance stuff it really comes in handy. I'm not sure why this would matter in this case, but I can't think of any other relevant package I would have installed on my machine that you wouldn't on the default loadset.

You can try:
Code: Select all
sudo apt-get install build-essential


Or you can just skip right ahead to installing the dependencies:
Code: Select all
sudo apt-get install libcupsys2 libdb4.6 libgnutls13 libkrb53


There might be more dependencies you need to install, but those were the only ones that were in the error message you first posted.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Next

Return to Other Operating Systems

Who is online

Users browsing this forum: No registered users and 3 guests

cron
cron