Wednesday, November 16, 2011

Using a Scientific Linux/CentOS/RHEL 6 Server for Time Machine

I recently tried to setup a Scientific Linux 6 server as a backup volume for Time Machine. I based my steps on these instructions for Ubuntu, but I thought there was enough differences that I thought it was worth posting what worked for me. I used Scientific Linux 6, but it should work just as well for CentOS 6 and Red Hat Enterprise Linux 6.

A few assumptions made in these instructions, you will want to replace them as appropriate:
  • The user's username is "user".
  • The Linux server has a hostname of "linux.example.com". If you don't have a hostname in DNS, you can use the server's IP address instead.

First, we need to setup the server:

1. Install the EPEL repository. I already had it on the machine, but if it's not yet installed, read and follow the instructions at http://fedoraproject.org/wiki/EPEL.

2. Install netatalk from the EPEL repository:
# yum install netatalk

3. Add the following line to the end of /etc/netatalk/afpd.conf:
- -transall -uamlist uams_randnum.so,uams_dhx.so -nosavepassword -advertise_ssh

4. Create the TimeMachine directory in the user's home directory or wherever you want it:
$ mkdir /home/user/TimeMachine

5. Add the following two lines to the end of /etc/netatalk/AppleVolumes.default. Note that I commented out the ~ line that was already present since I didn't want to enable home directory access; I just want to use this for Time Machine:
#~
/home/user/TimeMachine TimeMachine allow:user cnidscheme:dbd options:userdots,upriv

6. Configure netatalk to be started when the system boots:
# chkconfig netatalk on

7. Start netatalk:
# service netatalk start

8. Open the AFP port in the firewall. Go to System, Administration, Firewall. Click Other Ports, Add, then scroll down until you find Port 548, Protocol tcp, Service afpovertcp. Select it and click OK. Repeat for Port 548, Protocol udp, Service aftpovertcp. Click Apply, then close the Firewall Configuration window.

Now, on your Mac:

1. Verify that you can connect to the server. From the Finder's Go menu, choose Connect to Server. Enter the server address afp://linux.example.com and click Connect. You should be prompted for a username and password.

2. Configure Time Machine to allow you to use network volumes for Time Machine. Enter the following command in Terminal.app:
$ defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

3. Go to System Preferences, select Time Machine. Enable Time Machine and select your mounted TimeMachine volume. You will be prompted for a username and password that Time Machine will use to connect when it's performing the backup.

Labels: ,

4 Comments:

Blogger nicentral said...

Thanks for this! Although, for Mountain Lion, I had to add the option tm to the AppleVolumes.default file for my time machine backup share.

10/09/2012 5:36 PM  
Blogger David said...

Thanks for the update! When I wrote these instructions, I was running Leopard on the Mac, and haven't tried to use the Linux machine as a Time Machine backup disk since upgrading.

10/10/2012 1:55 PM  
Blogger Joan Bou said...

I'm Running CentOS 6 on the linux side, and Mountain lion on my MAC, and when i open finder and try to connect the username/passwd window pops up, but when i entry the login info it says:

The server version you are trying to connect its not compatible. Please contact your system administrator to resolve the problem. ( i hate this errors, im the system administrator lol)

Thanks and good post.

4/22/2013 11:20 AM  
Blogger Joan Bou said...

Its working now:
in:

/etc/netatalk/afpd.conf

I had to replace uams_dhx.so to uams_dhx2.so

And its working now..

4/22/2013 11:57 AM  

Post a Comment

<< Home