Mac OS X Server,  Ubuntu,  Unix

afp on Linux via Bonjour

Based on a few messages I got after the article on building netatalk to host afp on Linux, it looks like building netatalk to host your shares just isn’t enough. I guess people still like Bonjour or something… In that case, let’s make this netatalk thingie announce itself to the world (er, your local network)!

Avahi is much simpler than netatalk, given that there’s none of this dhx nonsense preventing us from using aptitude (again, this whole thing is for Debian/Ubuntu and you’re gonna’ need to escalate those privileges):

aptitude install avahi-daemon

Then we’re gonna’ need to teach it about the whole afpd service we built, which is done in the manner that makes the least sense for Debian, xml. Create a new file called /etc/avahi/services/afpd.service:

touch /etc/avahi/services/afpd.service

Then paste the XML in there (assuming you’re running afp on port 548:

<?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-group>

And now let’s kick that avahi daemon:

/etc/init.d/avahi-daemon restart

Not nearly as painful as netatalk, avahi makes for a very nice way to let Mac OS X clients know that your server is out there. OH, don’t forget to check that avahi is set in /etc/default/avahi-daemon (the AVAHI_DAEMON_START variable in there should be set to a 1).