RasPi Box

TimeMachine, NAS, AirPlay Receiver and Internet Radio

For a while I wanted to build a Raspberry Pi Box that combines different useful functionalities.

Parts needed

  • Raspberry Pi
  • USB sound card
  • Ethernet cable
  • Adafruit LCD + Keypad Pi Plate
  • Powered USB hub
  • External hard disk
  • A box

Setting up the Raspberry Pi

Internet

Since I'm using the RasPi Box as web server it has to connect with a static address.

Edit network configuration:

sudo nano /etc/network/interfaces

Change the line:

iface eth0 inet dhcp

to

iface eth0 inet static

On the next line add the following (note: you will need your own addresses):

address 192.168.192.110
netmask 255.255.255.0
network 192.168.192.0
broadcast 192.168.192.255
gateway 192.168.192.1

Then we'll need to reboot the Raspberry Pi

sudo reboot

Configure Raspberry Pi as TimeMachine

Install support for AFP filesystem

sudo apt-get update 
sudo apt-get install hfsplus hfsutils hfsprogs

Connect and mount the external hard disk

sudo mount -o force /dev/sda1 /mnt/TimeMachine

Find the drive UUID

sudo blkid

Automatically mount the hard drive on boot

sudo mkdir /mnt/TimeMachine
sudo nano /etc/fstab

Add a line to the end of the file with our Time Machine mounting preferences

UUID="AAAA-BBBB..." /mnt/TimeMachine hfsplus rw,force,exec,auto,users 0 3

Where AAAA-BBBB... is the UUID of our drive.

Change all the data owner to user "pi" to make sure we will be able to backup in future:

sudo chown -R pi /mnt/TimeMachine

Reboot

sudo reboot

Install and configure Avahi and Netatalk demons

The next step in order to use our Raspberry Pi as Time Machine we need to install Avahi and Netatalk

sudo apt-get install avahi-daemon libavahi-client-dev libdb5.3-dev db-util db5.3-util libgcrypt11 libgcrypt11-dev

Download, unpack and install Netatalk

wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.1.1.tar.bz2

tar -xvf netatalk-3.0.0.tar.bz2

./configure --with-init-style=debian --with-zeroconf

make

sudo make install