Build an OS X Friendly Linux Media Server From Your Old PC
Posted 12/10/2009 at 3:37pm
| by Arvind Srinivasan
4) Netatalk
Netatalk is software that allows you to broadcast using the Apple File Protocol, or AFP. Think of it as a Linux version of Bonjour.

First, install the software. Either search for Netatalk in the Synaptic Package manager, or go to Terminal (either on your new Linux box, or on your Mac, via ssh) and type:
sudo aptitude install netatalk
Now, you need to configure Netatalk to broadcast on a given connection. By default, your ethernet connection is named eth0, so that is what we will add to the configuration file.
To open the config file, type
sudo nano /etc/netatalk/atalkd.conf
in the terminal. This will open the file in the nano text buffer. At the bottom of the file (press the down arrow to scroll all the way down), type
eth0
Press Control+O to save, you'll be promted in the Terminal window to save to the defualt location. Press return to do so. Press Control+X to exit.
This version of netatalk is flawed, as it passes the password to the server in cleartext. By default, OSX does not allow this, but it is easy to enable it. Launch the Terminal application on your Mac and open a new tab or window (Command+T or Command+N), and type:
defaults write com.apple.AppleShareClient afp_cleartext_allow -bool true
Now, you should be able to connect to the server! In order to test the connection, go to Finder's menu barnavigate to
Go > Go to Server > afp://{ip address of server}
5) Install Avahi

The system we just set up is slightly annoying -- we recognize that you probably don't want to click through the Finder's menu bar every time you need to grab a file from the server. Installing Avahi will force the server to broadcast via AppleTalk, which will make it pop up in your Finder menu every time you are on the same network as it.

First, install the software. On the Linux box launch Terminal, type
sudo aptitude install avahi-daemon
Now, you need to configure the avahi daemon, which will run when the server starts up. Type
sudo update-rc.d avahi-daemon defaults
and then
sudo nano /etc/avahi/services/afpd.service

In the blank file that opens, copy and paste this:
<?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>
This will configure Avahi to use port 548, which is the default port for AFP. Press Control+X to exit and save the changes you've made

Now restart the daemon to configure the changes. In the terminal, type
sudo /etc/init.d/avahi-daemon restart
6) Firefly
Now you have a basic file server, but it isn't media ready just yet. To make your server more robust, you need to install several server applications. The first of these is Firefly, a basic iTunes server.

First, in Terminal, install the software by typing
sudo aptitude install mt-daapd
and then
sudo aptitude install libid3tag0
Mt-DAAPD is the iTunes server, and libid3tag0 installs standard ID3 tags, so that mt-daapd can interpret your music metadata properly.
Now, since you probably don't want to broadcast your main account, create a separate account that will contain your media. You can do this by right clicking > System > Users and Groups, or via the Terminal.
In Terminal, type
sudo adduser media
You'll be prompted to add a name, room number and phone number after this command. You can jsut add a name and hit return to skip through the rest of the queries.
su media
mkdir /home/media/music
exit
This will create a user named media. Make a directory called Music in media's home folder, and then exit.
Now, you can start the iTunes server. To do this, type
sudo /etc/init.d/mt-daapd start
Now, reset the server to the default configuration. Type
sudo update-rc.d mt-daapd default
In order to test the server, in a web browser, type http://{server ip address}:3689
This takes you to the Firefly admin page (the default Firefly port is 3689). It will now prompt you for a username and password. By default, both of these are 'mt-daapd'.

Click on "Configuration." You can now reset the default username and password. Next, in the text box labeled "extensions," add .MOV and .M4V, separated by commas. This will allow the server to scan for video files, playable by iTunes.
You can check the status of the server by clicking "server status." This will tell you which computers Firefly is streaming to, and what it is streaming. This is where you should go if you need to troubleshoot.
Click "save" to save the changes. To check your work, open iTunes on your Mac. You should see a shared library with any songs you have in the /home/media/music folder. Be sure to add media files to the Music folder we created above. You can drag and drop songs over the network from your Mac to the Linux box.
Next: Install PulpTunes and Torrent Server