Nach langem Suchen habe ich eine super Anleiung gefunden den Berühmten Netatalk Server 2.2.0 OS 10.7 tauglich zu machen!
In the web you find a lot of information on how to build a server for Apple Time Machine or little work-groups with Mac clients. Some ideas are build upon SMB as file server protocol others use Apple Filing Protocol (AFP). Some guides are very good, but rather old (like this one) and will not work with OS X Lion. Another guide gives all the information that is needed to build a server for Time Machine, but is missing the basic for information on how to install AFP.
With this article i want to give you a complete guide for installing Netatalk (AFP) and building an own Time Machine backup server, using Ubuntu Server 10.4 LTS. …and yes, it will be fully compatible with OS X Lion and behaves like a Time Capsule from Apple! All modifications are done on the Linux machine. Nothing has to be changed on the Mac.
A few days ago the open source community silently released the Netatalk Package 2.2.0 with support for AFP 3.0, which is necessary for OS X Lion and Time Machine.
Warning: I use Ubuntu Server 10.04 LTS for this guide and haven‘t tried it with other versions or Linux distributions. It is wise to make a complete backup of the Linux server machine before you go on. I’m not responsible for any form of damage or data loss.
Let‘s start:
At first ssh to your ubuntu server machine and login as root.
Hint: If you are not logged in as root-user, you have to „sudo“ every shell command in this article!
Now make sure that your machine is up-to-date with:
apt-get update
apt-get upgrade
Netatalk must not be installed! If you are not sure, remove it with:
apt-get remove netatalk
Next step is to install all necessary packages to build netatalk from the sources:
apt-get build-dep netatalk
apt-get install cracklib2-dev fakeroot libssl-dev
Now download and extract netatalk 2.2.0 from sourceforge:
wget http://sourceforge.net/projects/netatalk/files/netatalk/2.2/netatalk-2.2.0.tar.bz2
tar xfvj netatalk-2.2.0.tar.bz2
cd netatalk-2.2.0
Configure, compile and install the extracted sources:
./configure --enable-debian --enable-pgp-uam --enable-krb4-uam --enable-krbV-uam --enable-overwrite
Hint: I disabled cups, because i don‘t need printer support.
make
make install
The make command will compile the sources and takes a while. Both commands dumping a lot of information but should complete without errors.
Now it‘s time to configure netatalk:
First edit
/usr/local/etc/netatalk/AppleVolumes.default
Search for the following lines in the configuration file and make sure they are switched on / off like this:
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no
This will switch on Apple Filing Protocol (AFP) and meta information database.
Old AppleTalk, Printer server, Time synchronization and boot support are not needed.
Next edit /usr/local/etc/netatalk/afpd.conf
Go to the last line and make sure it looks like this:
– -tcp -noddp -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword
This configures the behavior of the virtual file server and is explained in the afpd.conf man pages.
After that we need to edit the file where all shared volumes are configured: /usr/local/etc/netatalk/AppleVolumes.default
Search for ~ in the file and remove it, otherwise all Linux home folders will be accessible as shared volumes. Add a share for TimeMachine and configure the maximum size of the virtual volume, like this:
/backup/TimeMachine TimeMachine allow:userXY cnidscheme:cdb options:usedots,upriv,tm volsizelimit:200000
Description of parameters:
/backup/TimeMachine – location for TimeMachine backups on the Linux machine
TimeMachine – Name of the network share
allow:userXY – allowed user (read/write access) – can be a comma separated list of users or groups – group names have a @ as prefix (like this: @users)
cnidscheme:cdb – type of database for meta information
options:usedots,upriv,tm – This share supports .Files/.Folders (usedots) with special privileges (upriv) and is time machine compatible ™
volsizelimit:200000 – Is the maximum size of the virtual volume (in this example: 200 GB)
Please read the man pages for all options, or search for AppleVolumes.default in the web.
Here is a another example for a simple network share:
/data/music MusicFiles allow:@users cnidbscheme:cdb options:usedots
This allows all people in the group „users“ read/write access to a share named „MusicFiles“.
Now it‘s time to restart netatalk:
/etc/init.d/netatalk restart
Actually you won‘t see your shares on the Mac, because there is no service on the Linux machine that publishes them. We need to install the Avahi-daemon first:
apt-get install avahi-daemon
apt-get install libnss-mdns
Let‘s configure avahi:
First edit /etc/nsswitch.conf
Add the word mdns to the following line:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Last step is to create service configuration file for publishing.
Create a new file /etc/avahi/services/afpd.service and copy/paste the following XML:
<?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=AirPort</txt-record>
<txt-record>sys=waMA=«Server MAC Address»,adVF=0×100</txt-record>
<txt-record>dk0=adVF=0×81,adVN=TimeMachine</txt-record>
</service>
</service-group>
A few modifications have to be made, before you save and close the new file.
In the field „model=AirPort“ you can choose between PowerBook, PowerMac, Macmini, iMac, MacBook, MacBookPro, MacBookAir, MacPro, AppleTV1,1, AirPort, Xserve. This will be the type of icon you will see in Finder on the Mac.
Replace «Server MAC Address» with the mac address of your Linux server in the field sys=waMA=«Server MAC Address»,adVF=0×100.
(You can determine it with ifconfig eth0 in the terminal)
The next line needs a bit more explanation:
dk0=adVF=0×81,adVN=TimeMachine
dk0= is the volume number. You can create more than one backup volume. Just create more txt-record entries in the file with dk1=… dk2=… and so on.
adVF=0×81 is the AirDisk flag, which tells OS X that this volume has support for TimeMachine.
adVN=TimeMachine is the name of the network share we configured in AppleVolumes.default
Finally we are ready to restart avahi:
/etc/init.d/avahi-daemon restart
Hint: Avahi daemon automatically checks and reloads the service configuration file if something has changed
After a few seconds the icon of our new server should appear in Finder. Now configure Time Machine on the Mac. In the list of available volumes you should see the record „TimeMachine on serverXY“.
Initial backup will take very long. (In my case 9 hours!) – This is the same behavior as on a real Time Capsule.
What i forgot:
When you click the server icon in finder, all your configured shares (from AppleVolume.default) will appear after a login with your Linux username and password.
I hope this guide will help you setting up a Linux based Time Machine and workgroup server.
Thanks so much for this guide. I’ve spent hours trying to get this to work and finally stumbled upon this and got it going first time!
Just one thing, I think when you refer to editing the lines:
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no
in /usr/local/etc/netatalk/AppleVolumes.default, I think you meant /etc/defaults/netatalk, am I right?
Thanks again! 😀
Hello i think you’re right
Hi, erst mal thx für das gut tutorial. Zur Info für dich, da haben sie 2-3 fehler in der xml konfiguration eingeschlichen.
version=”1.0? standalone=’no’
replace-wildcards=”yes”
Muss heissen
version=“1.0″ standalone=“no“
replace-wildcards=“yes“
Sonst gibt es immer eine fehlermeldung im syslog und der Start bricht ab.
Super Danke werde es abändern =)
Hi, erst mal thx für das gut tutorial. Zur Info für dich, da haben sie 2-3 fehler in der xml konfiguration eingeschlichen.
%h
Muss heissen
%h
Sonst gibt es immer eine fehlermeldung im syslog und der start bricht ab.