Creating Your Own Time Machine….Server

Dr. Who, Marty McFly, and Steve Jobs all had the same vision, Time Travel.  While a Tardis, a Delorean. and a Steam Engine seem like the most logical choice for this task, im going to show you that with a basic computer, and some Linux magic, you too can Travel Time.

Mac OS X Leopard introduced a great feature call Time Machine, which gave end users the ability to keep a fresh backup of their computer with the use an external hard drive.  As the operating system and related peripherals evolve, the ability to backup your systems to a network drive became increasing easier, for a price.  While I am one to say that i’ve been drinking the Apple Kool-Aid, I can’t bring myself to purchase an expensive Apple branded Time Capsule or wireless access point to backup my computers through my local network; enter Linux.

I don’t want to dive into a Linux Distro conversation, but I used to be a Fedora man.  Their use of bleeding edge kernel updates and having to constantly recompile drivers was right in my wheelhouse, but time consuming.  I prefer CentOS, and for this paper, is the Distro of choice.

  1. Download and install a minimal server of CentOS (there are a number of tutorials on the web that can walk you through this.)
  2. The following are some setup items that I always do when setting up a CentOS server:
    Disable the firewall, you can enable it again later.

    Disable SELinux

    • vi /etc/sysconfig/selinux
    • # This file controls the state of SELinux on the system.
      # SELINUX= can take one of these three values:
      #               enforcing – SELinux security policy is enforced.
      #               permissive – SELinux prints warnings instead of enforcing.
      #               disabled – SELinux is fully disabled.
      SELINUX=disabled # change
      # SELINUXTYPE= type of policy in use. Possible values are:
      #               targeted – Only targeted network daemons are protected.
      #               strict – Full SELinux protection.
      SELINUXTYPE=targeted
    • hit esc  :  wq   enter  to exit vi

    Setup the Networking
    For this setup im using DHCP, if you want a static IP, you’ll need to set it up.

    • vi /etc/sysconfig/network-scripts/ifcfg-eth0
    • Change ONBOOT=no to yes
    • hit esc  :  wq   enter  to exit vi
    • /etc/rc.d/init.d/network restart
    • chkconfig network on

    Disable IPv6 if you don’t need it

    • echo “install ipv6 /bin/true” > /etc/modprobe.d/disable-ipv6.conf
    • reboot

    Setup Repos

    • yum -y install yum-plugin-fastestmirror
    • yum -y install http://epel.mirror.freedomvoice.com/6/x86_64/epel-release-6-8.noarch.rpm

    Install Netatalk

    • yum -y install netatalk

    Install Avahi

    • yum -y install avahi

    Create a User

    • useradd geoffrey
    • passwd geoffrey

    Configure Netatalk

    • vi /etc/netatalk/afpd.conf
    • Add this line to the bottom of the file
      – -transall -uamlist uams_randnum.so,uams_dhx2.so -nosavepassword -advertise_ssh
    • hit esc  :  wq   enter  to exit vi
    • vi /etc/netatalk/AppleVolumes.default
    • Add this to the bottom of the file (for each user you want to allow, create a new line substituting their home folder path and allow: statement.  You could create a group of users, and use the group name in the allow: statement and give permissions to a shared location on the server, but I find this more secure)
      /home/geoffrey TimeMachine allow:geoffrey options:usedots,upriv,tm cnidscheme:dbd volsizelimit:100000

    Configure the advertisement with Avahi

    • vi /etc/avahi/services/afpd.service
    • Add this information into the file:
      <?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>
    • hit esc  :  wq   enter  to exit vi

    Make Netatalk and Avahi start at Boot Time

    • vi /etc/rc.local
    • Add this information to the file:
      sleep 15
      /etc/init.d/avahi-daemon restart
      /etc/init.d/netatalk restart
    • hit esc  :  wq   enter  to exit vi

    Setup Your Mac’s Time Machine

    • Navigate to System Preferences>Time Machine
    • Click on Select Disk, you should see your Time Machine volume presented to you.  Select your volume, then click “Use Disk.”
      TimeMachine
    • Keep in mind your first backup will take a considerable amount of time, with subsequent backups only taking the delta changes.
    • Once your backup starts, your Mac will mount your network volume, and begin backing up.
      TimeMachine2

As you can see, my cat has been skinned, my Mac is being backed up, and I didn’t have to use a flux capacitor to alter my future.

Posted in Mac, Tech