Avahi and Netatalk Installation
Avahi is the open source implementation of what Apple calls Bonjour. It means that your new DIY Time Capsule will be advertised on your network and your Mac will know about it. So it’s good to install.
For Leopard and Snow Leopard, we need Netatalk 2.0.5 or above. However, in order to maintain compatibility with Lion we need version 2.2 or above for full AFP 3.3 support.
Debian Stable currently has version 2.1.2, which isn’t enough. But Debian Testing has 2.2 which is what we are after. So while our entire installation comes from the Stable repositories, we need to pick up Netatalk from the Testing repositories.
This will load the file up in a text editor called nano. Paste the following lines into the bottom
deb http:/ftp.us.debian.org/debian/ wheezy main deb-src http:/ftp.us.debian.org/debian/ wheezy main
and comment out the line at the top that starts with deb cdrom, i.e. insert a ‘#’ symbol at the beginning of the line.
Save and exit by pressing control+o then control+x.
Set the default repository to use:
echo APT::Default-Release "squeeze"\; >> /etc/apt/apt.conf
Then update the list of the available packages
There are some dependencies and other packages that we must install first
apt-get install avahi-daemon libnss-mdns
Select the default option for any questions asked.
Now install Netatalk, specifying the Wheezy/testing repository.
apt-get install netatalk libc6-dev -t wheezy
This will install the testing version of netatalk and a load of required dependencies.
Now we need to tell Netatalk to share the volume we created and mounted earlier. Type the following at the command prompt. Make sure it is entered as one line.
echo /mnt/MyTimeCapsuleData MyTimeCapsule allow:tmuser cnidscheme:dbd options:tm >> /etc/netatalk/AppleVolumes.default
Avahi ConfigurationNow we must configure Avahi so it knows which services it should advertise.
We need to edit a file now, so type in the following:
Use the cursor keys to navigate down to the line that looks like this:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
and add ‘mdns’ at the end
Press control+o to save and then control+x to exit
Now we have to create the file that tells Avahi that our machine offers an AFP service (which happens to be a Time Capsule).
And then paste in the following
<?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=TimeCapsule</txt-record> </service> </service-group>
Note how we specify the txt-record to be TimeCapsule, so that we get the correct icon.Again press control+o and control+x.
Now restart Netatalk and Avahi.
Now check that your DIY Time Capsule is working. With a little luck, if you go back to your MacOS X machine in your side bar you will see a network machine called MyTimeCapsule with a little Time Capsule icon.
If you go into Time Machine, you should now be able to select the virtual machine.
I’m going to do a bit of cleanup of this virtual machine to reduce the size for downloading. This will remove different languages, manual pages and packages that we won’t need.
This section is entirely optional. Type or copy/paste the following,
apt-get install localepurge deborphan debfoster localepurge
This next one all goes on one line:
apt-get remove --purge manpages manpages-dev vim-common vim-tiny traceroute man-db gcc-4.3 cpp-4.3 info eject tasksel tasksel-data xfonts-base xserver-xorg nfs-common exim4 rpcbind debian-faq doc-debian doc-linux-text ftp
Then a few more lines:
deborphan | xargs apt-get -y remove --purge rm -rf /usr/share/doc/ rm -rf /usr/share/doc-base/ rm -rf /usr/share/man/ rm -fr /var/lib/apt/lists/*
I also removed SSH (via the VirtualBox window) since we won’t need it anymore. Leaving it installed is a bit of a security risk, because I just know that some people won’t change the password!
apt-get remove openssh-server --purge apt-get autoremove --purge; apt-get clean all
At this point my Debian installation is using 350 MB.
Now if we ‘zero out’ the free space on the disk, it will compact and compress better:
dd if=/dev/zero of=TEMP bs=1M; rm TEMP
Now we have finished creating the appliance, so shut it down with the command
shutdown --hP now
Once it has shut down, I am going to compact the virtual disks.
In the Windows command line on the host type in:
vboxmanage modifyhd MyTimeCapsule.vdi --compact vboxmanage modifyhd MyTimeCapsuleData.vdi --compact
Create a Downloadable Appliance
Now make an appliance by selecting File: Export Appliance, which will result in a compressed .ova file that you can load into VirtualBox, as shown in Part 1.
It is interesting to note that the export actually creates .vmdk disks (the VMware format) instead of .vdi because the .ova format was created by VMware. However, it doesn’t really affect the outcome of this article.
I hope you enjoy your new Time Machine backup server.
Related Items:How To Make A Windows Time Machine Server: Part 1
Debian now available for QNAP NASes
How To: Convert your Xbox to a NAS - Part 2
How To: Asterisk Answering Machine
Debian adds selected NAS support