用CentOS 配置 TimeMaChine 服务器
Download
netatalk-3.1.7-0.1.fc21.src.rpm
Netatalk 3.1.7 SRPM for Fedora and CentOS – Netatalk Wiki
Build
At least, “rpm-build“, “gcc” and “make” packages are needed.
# yum install rpm-build gcc make
Install the SRPM.
$ rpm -ivh netatalk-X.X.X-XXX.XXX.src.rpm
The following messages don’t have a problem.
warning: group hat does not exist - using root warning: user hat does not exist - using root
Build by using “rpmbuild” command.
If “error: Failed build dependencies: zzz” is displayed, execute “yum install zzz“.
$ cd ~/rpmbuild/SPECS/ $ rpmbuild -bb netatalk.spec
Install or Upgrade
Install by using rpm” command.
If “error: Failed dependencies: xxx is needed by…” is displayed, execute “yum install xxx“.
If you install the netatalk for the first time, use “-i” option.
$ cd ~/rpmbuild/RPMS/XXX/ # rpm -ivh netatalk-X.X.X-XXX.XXX.XXX.rpm
If the old netatalk already been installed, update by “-U” option.
# rpm -Uvh netatalk-X.X.X-XXX.XXX.XXX.rpm
Check
Check features and paths, using “afpd -V“.
$ /usr/sbin/afpd -V afpd 3.1.7 - Apple Filing Protocol (AFP) daemon of Netatalk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Please see the file COPYING for further information and details. afpd has been compiled with support for these features: AFP versions: 2.2 3.0 3.1 3.2 3.3 3.4 CNID backends: dbd last tdb mysql Zeroconf support: Avahi TCP wrappers support: Yes Quota support: Yes Admin group support: Yes Valid shell checks: Yes cracklib support: Yes EA support: ad | sys ACL support: Yes LDAP support: Yes D-Bus support: Yes Spotlight support: Yes DTrace probes: Yes afp.conf: /etc/netatalk//afp.conf extmap.conf: /etc/netatalk//extmap.conf state directory: /var/netatalk/ afp_signature.conf: /var/netatalk/afp_signature.conf afp_voluuid.conf: /var/netatalk/afp_voluuid.conf UAM search path: /usr/lib64/netatalk// Server messages path: /var/netatalk/msg/
In case of EL6, Spotlight is not supported.
Setting Up
Edit “/etc/netatalk/afp.conf“.
Ex:
[Global] [Homes] basedir regex = /home [Test Volume] path = /export/test1 [My Time Machine Volume] path = /export/timemachine time machine = yes vol size limit = 512000
It’s recommended to enable extended attributes of filesystem. You can check it by “getfattr” and “setfattr” commands.
If you use ACL, you shoud check it by “getfacl” and “setfacl” commands.
If these are disabled, use “tune2fs” command or edit “/etc/fstab” file.
Ex:
/dev/sdc2 /mountpoint ext4 defaults,user_xattr,acl 0 2
You should check firewall. AFP’s port number is 548. Zeroconf’s port number is 5353.
You also should check SELinux. SELinux may interfere with operation of D-Bus.
Enabling and Starting
You must run Avahi ahead of Netatalk.
Fedora and EL7
# systemctl enable avahi-daemon # systemctl enable netatalk # systemctl start avahi-daemon # systemctl start netatalk
EL6
# chkconfig avahi-daemon on # chkconfig netatalk on # service avahi-daemon start # service netatalk start
Spotlight Feature
Fedora and EL7
If you use Spotlight feature, set “spotlight = yes” in [Global] section.
There is a bug.
- Bug#543 Spotlight cannot search in user homes
- Spotlight: searching in user homes, bug #543 by hat001 · Pull Request #7 · Netatalk/Netatalk
EL6
This package does not support Spotlight because there is no Tracker package.
root登入不上,需要创建用户。
配置afp.conf文件:
[My Time Machine Volume]
path = /export/timemachine
valid users = tc
rwlist = tc
time machine = yes
vol size limit = 512000
创建用户,记得GID和UID都是50000
[root@netatalk ~]# groupadd -g 50000 tc
[root@netatalk ~]# useradd -u 50000 -g tc -s /usr/bin/false -d /home/tc tc
[root@netatalk ~]# passwd tc