|
|
@@ -0,0 +1,175 @@ |
|
|
# Building and setting up netatalk 3.1.2 on Debian |
|
|
|
|
|
## 1. Build |
|
|
|
|
|
### Install dependencies |
|
|
|
|
|
sudo apt-get install automake libtool build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libssl-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev libcrack2-dev libpam0g-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev libwrap0-dev systemtap-sdt-dev libacl1-dev libldap2-dev |
|
|
|
|
|
### Download and unpack netatalk 3.1.2 |
|
|
|
|
|
wget http://downloads.sourceforge.net/project/netatalk/netatalk/3.1.2/netatalk-3.1.2.tar.bz2 |
|
|
tar xvf netatalk-3.1.2.tar.bz2 |
|
|
|
|
|
### Configure and make |
|
|
|
|
|
cd netatalk-3.1.2 |
|
|
./configure --with-init-style=debian --with-zeroconf --with-cracklib --with-pam-confdir=/etc/pam.d --with-dbus-sysconf-dir=/etc/dbus-1/system.d |
|
|
|
|
|
After successfull configuration the configure summary should look like this |
|
|
|
|
|
Configure summary: |
|
|
INIT STYLE: |
|
|
debian |
|
|
AFP: |
|
|
Extended Attributes: ad | sys |
|
|
ACL support: yes |
|
|
Spotlight: no |
|
|
CNID: |
|
|
backends: dbd last tdb |
|
|
UAMS: |
|
|
DHX (PAM SHADOW) |
|
|
DHX2 (PAM SHADOW) |
|
|
RANDNUM (afppasswd) |
|
|
clrtxt (PAM SHADOW) |
|
|
guest |
|
|
Options: |
|
|
Zeroconf support: yes |
|
|
tcp wrapper support: yes |
|
|
quota support: yes |
|
|
admin group support: yes |
|
|
valid shell check: yes |
|
|
cracklib support: yes |
|
|
ACL support: auto |
|
|
Kerberos support: auto |
|
|
LDAP support: yes |
|
|
AFP stats via dbus: yes |
|
|
dtrace probes: yes |
|
|
Paths: |
|
|
Netatalk lockfile: /var/lock/netatalk |
|
|
init directory: /etc/init.d |
|
|
dbus system directory: /etc/dbus-1/system.d |
|
|
pam config directory: /etc/pam.d |
|
|
Documentation: |
|
|
Docbook: no |
|
|
|
|
|
make |
|
|
|
|
|
### Install |
|
|
Use the option `--fstrans=no` to prevent failing of `mkdir -p` commands during the install. |
|
|
|
|
|
sudo checkinstall --fstrans=no |
|
|
|
|
|
|
|
|
## 2. Setup |
|
|
|
|
|
### Install HFS packages |
|
|
I am using a USB HDD, which was formatted on my Mac as a HFS+ (journaled) volume. In order to mount and use this drive we have to install the necessary HFS packages: |
|
|
|
|
|
sudo apt-get install hfsplus hfsutils hfsprogs |
|
|
|
|
|
### Mount the drive |
|
|
Create the mount destination folder |
|
|
|
|
|
sudo mkdir /mnt/Backup |
|
|
|
|
|
Get the drive's UUID |
|
|
|
|
|
sudo blkid |
|
|
|
|
|
Add the drive to `/etc/fstab` |
|
|
|
|
|
UUID=<UUID from blkid> /mnt/Backup hfsplus force,defaults 0 0 |
|
|
|
|
|
Mount it |
|
|
|
|
|
sudo mount /mnt/Backup |
|
|
|
|
|
Set appropriate permissions |
|
|
|
|
|
sudo chown backup:backup /mnt/Backup |
|
|
sudo chmod 2775 /mnt/Backup |
|
|
|
|
|
### Netatalk configuration file |
|
|
|
|
|
The configuration file is found under `/usr/local/etc/afp.conf`. Make sure to create the folders specified in the path of each volume. |
|
|
|
|
|
; |
|
|
; Netatalk 3.x configuration file |
|
|
; |
|
|
|
|
|
[Global] |
|
|
; Global configuration |
|
|
hostname = Backup |
|
|
log file = /var/log/netatalk.log |
|
|
log leve = default:info |
|
|
zeroconf = yes |
|
|
valid users = @backup |
|
|
save password = yes |
|
|
mimic model = TimeCapsule |
|
|
hosts allow = 192.168.178.0/24 |
|
|
|
|
|
[Backup] |
|
|
; Backup folder for every user in group 'backup' |
|
|
path = /mnt/Backup/Backup |
|
|
valid users = @backup |
|
|
|
|
|
[TimeMachine A] |
|
|
; Time Machine folder for user A, that only he can access |
|
|
path = /mnt/Backup/TM-userA |
|
|
valid users = userA |
|
|
vol size limit = 409600 |
|
|
time machine = yes |
|
|
|
|
|
[TimeMachine B] |
|
|
; Time Machine folder for user B, that only he can access |
|
|
path = /mnt/Backup/TM-userB |
|
|
valid users = userB |
|
|
vol size limit = 204800 |
|
|
time machine = yes |
|
|
|
|
|
Restart netatalk |
|
|
|
|
|
sudo service netatalk restart |
|
|
|
|
|
## Autostart script |
|
|
|
|
|
#!/bin/bash |
|
|
### BEGIN INIT INFO |
|
|
# Provides: TimeMachine |
|
|
# Required-Start: |
|
|
# Required-Stop: |
|
|
# Default-Start: 2 3 4 5 |
|
|
# Default-Stop: 0 1 6 |
|
|
# Short-Description: Start TimeMachine. |
|
|
# Description: Enable TimeMachine service and mount the drive. |
|
|
### END INIT INFO |
|
|
|
|
|
DUUID="<UUID from blkid>" |
|
|
MNTP="/mnt/Backup" |
|
|
|
|
|
if [ "$(id -u)" != "0" ]; then |
|
|
echo "This script must be run as root" 1>&2 |
|
|
exit 1 |
|
|
fi |
|
|
case "$1" in |
|
|
start) |
|
|
service netatalk stop |
|
|
service avahi-daemon stop |
|
|
umount -l $MNTP |
|
|
sudo fsck.hfsplus -f `blkid -U $DUUID` |
|
|
mount -t hfsplus -o force `blkid -U $DUUID` $MNTP |
|
|
service avahi-daemon start |
|
|
service netatalk start |
|
|
;; |
|
|
stop) |
|
|
service netatalk stop |
|
|
service avahi-daemon stop |
|
|
umount -l $MNTP |
|
|
;; |
|
|
*) |
|
|
echo "Usage: /etc/init.d/TimeMachine {start|stop}" |
|
|
exit 1 |
|
|
;; |
|
|
esac |
|
|
exit 0 |