Have you ever had a need for large amounts of storage space but didn’t want to shell out thousands of dollars just to get something crapple-approved. In this short howto I will show you how to create a storage device that will talk Apple file protocol and be usable by Time Machine. For all the ease in the world a picture is worth a thousand words but a film is worth a thousand pictures.

There are plenty of other howtos on the web that have been created over time some examples are
http://blog.damontimm.com/how-to-install-netatalk-afp-on-ubuntu-with-encrypted-authentication/
and
http://www.kremalicious.com/2008/06/ubuntu-as-mac-file-server-and-time-machine-volume/
If you are wishing for better details on why and what is presented here then you might want to check those out as well.
I am basing this one on Ubuntu 9.10. I am using some instructions found at several locations but I am focusing the effort here on the newest version of the Desktop Ubuntu.
First thing you will need to get a copy of Ubuntu and burn a disc. Head over to http://www.ubuntu.com/ and download the latest Desktop ISO. Thats right I am using the Desktop version and not the server version, although either could be used very easily since the instructions are mostly command line anyway. If you wish to use a virtual machine head over to http://chrysaor.info/. There you will find the best possible source for Ubuntu VM’s with vmware tools installed.
Now burn that image to a cd. If you can’t figure out how to do this then please stop reading and go to www.google.com and search for how to burn an ISO image. If you can’t figure that out then please stop using a computer. Now we install on a computer that you are not using for anything else, preferrably with a large amount of storage space. I won’t go into details and I will assume that you are not an idiot and won’t format and install over a good working machine that you actually wanted to keep.So for installation I won’t cover much; just that everything is as default and I used Guided partitioning.
I highly recommend using a virtual machine if you test this out first.

Now when you first boot into your new Linux desktop you need to run updates right away. Click on System=>Administration=>Update Manager or it may just pop up like it normally does as soon as you login.

Ok so lets get to stupid part, this is the command line method. Open a terminal up Applications=>Accessories=>Terminal and type the following:
Each line is a separate command, replace with the version that gets downloaded presently this is 2.0.4.
sudo apt-get install cracklib2-dev fakeroot libssl-dev
apt-get source netatalk
sudo apt-get build-dep netatalk
mv netatalk- netatalk
cd netatalk
sudo DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc -rfakeroot

The long and short of this is that we are downloading a bunch of crap and then attempting to have the most excellent software that is Ubuntu rebuild a useful package. If you can’t figure out the above, no worries there is a link further down for a prebuilt one that might work.
At this point the console should start to spit massive amounts of gobble-de-gook that you can safely ignore.
Now install the newly created deb package using the following command. We will also be preventing the system from updating and overwriting your newly installed deb package. Again replace with the version that is present.
sudo dpkg -i netatalk_.deb
echo “netatalk hold” | sudo dpkg –set-selections

Now lets go to an easier (read right way) method.
If the above seems complicated simply download the version I built here and install it by double clicking it and using the gdebi installer :)
Or for the more adventurous try the following: (copy and paste into a terminal)

sudo apt-get install cracklib2 libssl
sudo dpkg -i http://nerdoftherings.net/blog/dl_files/netatalk_2.0.4-beta2-5ubuntu2_i386.deb
echo “netatalk hold” | sudo dpkg –set-selections

If that still isn’t easy enough for you then please consider reading the entire posts from the links above, then you’ll see how much easier it is :) .
Now we need to configure our new installation before we can use it. Out of the box you (should) have access to your home directory by just browsing the network using your Mac.
The following are the files we want to deal with are:

1. /etc/hosts
1. this is for making sure our computer can find itself, doesn’t really matter unless you need your computer to have a specific name
2. /etc/netatalk/afpd.conf
1. Main configuration file for AFP file sharing daemon
2. This is where you decide what your server will show up as
3. /etc/netatalk/AppleVolumes.default
1. Where we tell the computer what to share and how to share it
4. /etc/default/netatalk

To keep things very simple please do the following:
Press ALT+F2
Enter ‘gksu gedit‘ without the quotes
Enter your password when prompted. That command will give us a text editor that has full access to everything on the system, use with caution but realize this is nothing different than your windows or Mac compy does for you naturally. Now we will simply save some files where we want them rather than editing some crap here and there.
First file we will be editing is /etc/hosts so go to file and open /etc/hosts
Add the following line: (replace servername with whatever you want to call this server)
127.0.1.1 servername.local servername
You will notice that there are some other things in that file, please don’t jack with them cuz you will screw up something important. Save that file and close that file, not the application or you loose it and have to launch it again.
Moving on, next file is /etc/netatalk/afpd.conf so File=>Open that file and enter the following again replacing with whatever you have chosen as your servername.
“servername” -transall -uamlist uams_randum.so,uams_dhx.so,uams_clrtxt.so -nosavepassword
This gives us a servername that will let us connect using encrypted password or cleartext and won’t let us save our password for the given share. If you have a good reason not to forbid saving a password simply leave that switch out. Save that file and close that file, not the application or you loose it and have to launch it again.
Next up /etc/netatalk/AppleVolumes.default. File=>Open that file and add the following, here you replace the with whatever you choose and hoseb with your username you log on with:
~/ “Home Directory” /<path/to/share/name “sharename” allow:hosebuser,@hosebgroup cnidscheme:cdb options:usedots,upriv
This will make a share of sharename show up in the list when we connect to our server using finder. We will also be using the default share that connects us to our home directory on the server.
Now we can save that file and close the editor.
We will now create the folders for the share(s) we just created.
Press ALT+F2 and type ‘gksu nautilus‘ without the quotes. Enter your password when prompted. This will give us a full access pass to the entire system using ROOT privileges, this is a bad idea but again it is no worse than normal access on your windows or Mac compys.
First we need to the / (root) directory so click on the File System directory on the left hand side. Now somewhere in this directory make a folder by pressing File=>Create Folder. When the new directory first comes up it will let you change the name to the name you chose earlier for sharename.
Now right click on the folder and select Properties from the context menu. Choose the Permissions Tab. Change the Owner in the drop down box next to the Owner field to your username. Ensure that the Folder access: is set to Create and Delete files.
Now we need to make it so our mac can “browse” to our new “server”. To do this we will modify the Avahi daemon included with Ubuntu (all other filesharing uses this).
Press ALT+F2 and enter
gksu gedit /etc/avahi/services/afpd.service
This will open our file editor with a new document that will become an “advertisement” on the network for our mac. This is a very simple XML document but it is most crucial that it is present or we won’t be able to just browse and enjoy our file shares. Enter the following into that document (copy and paste):

<?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>
</code>

What this does is says that we have an AFP server on port 548 and that it is an Xserve, this gives us a pretty mac icon in Finder.
You can now save the file and close the editor.
We could go ahead and restart each service to complete our configuration but since that takes longer than a reboot we will simple reboot the computer using the right hand menu on the top taskbar.
Now to help with any stupidity I am again posting a link to the video of this. If you can’t follow the words and video doesn’t help you then ….. whatever dude.
Happy Mac’ing

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>