Create Apple Time Capsule for Time Machine backups using Centos 6.5

I have been looking for the parts required to put together so that I can backup all the macs on a linux server hosted here in my lab.  What follows is the my “yum ready” instructions.

  • Start With Centos 6.5 Minimal Distribution
  • We need to create the file space where the Time Machine is going to save the files. I chose /home/tony/timemachine
    • Create the user:
      adduser lynn #create user
      passwd lynn  #set password
    • Create the path:
      mkdir -p /home/lynn/timemachine
    • Set ownership:
      chown -R lynn:lynn /home/lynn
  • Install wget
    yum -y wget
  • Install the EPEL Repository
    wget http://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
    yum localinstall epel-release-6-8.noarch.rpm
  • Use Yum to install the required packages:
    yum -y install netatalk avahi  dbus nss-mdns
  • Set services to start at boot:
    chkconfig netatalk on
    chkconfig messagebus on
    chkconfig avahi-daemon on
  • Now configure netatalk by posting this line at the very bottom of the file:
    - -transall -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh
    (Yes, just like that)
  • Edit /etc/netatalk/AppleVolumes.default and create the network shares. You’ll need one for each laptop you want to backup:
    /home/lynn/timemachine allow:lynn options:usedots,upriv,tm dperm:0775 fperm:0660 cnidscheme:dbd
  • Next edit /etc/nsswitch.conf
    hosts:      files mdns4_minimal dns mdns mdns4
  •  Create  /etc/avahi/services/afpd.service with the contents:

    <?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>0</port>
    <txt-record>model=TimeCapsule</txt-record>
    </service>
    </service-group>

  • Remove the ssh service from Avahi
     mv /etc/avahi/services/ssh.service /etc/avahi/services/ssh.service.disabled
  •  IPTABLES are running by default, so add the following to open up some ports and then save the iptables config:

    iptables -I INPUT -p udp –dport 548 -j ACCEPT
    iptables -I INPUT -p tcp –dport 548 -j ACCEPT
    iptables -I INPUT -p tcp –dport 5353 -j ACCEPT
    iptables -I INPUT -p udp –dport 5353 -j ACCEPT
    iptables -I INPUT -p udp –dport 5354 -j ACCEPT
    iptables -I INPUT -p tcp –dport 5354 -j ACCEPT

    service iptables save
  • 
    

    Start the required services:

    service avahi-daemon start
    service messagebus start
    service netatalk start

 

When you open Time Machine on your mac (mine is a MacBook Air running Mavericks), click the locked padlock to allow changes, which also enables the add/remove a backup disk. Click Add/remove and you should see your network Time Machine disk.

%d bloggers like this: