如何在 Centos7.x 中安装配置 Apple Time Capsule 替代软件用作 Time Machine 盘

安装基础软件

yum install -y rpm-build gcc make bison docbook-style-xsl flex dconf

安装 netatalk 依赖软件

yum install -y tracker-devel libtdb-devel \
systemtap-sdt-devel quota-devel pam-devel \
openssl-devel  openldap-devel  mysql-devel  \
krb5-devel  libgcrypt-devel  libevent-devel  \
libattr-devel libacl-devel  docbook-style-xsl  \
dbus-glib-devel  cracklib-devel  avahi-devel \
tcp_wrappers-devel perl-IO-Socket-INET6

安装 netatalk,
参考: http://netatalk.sourceforge.net/wiki/index.php/Netatalk_3.1.10_SRPM_for_Fedora_and_CentOS

curl -O http://www003.upp.so-net.ne.jp/hat/files/netatalk-3.1.10-0.1.1.fc26.src.rpm
rpm -ivh netatalk-3.1.10-0.1.1.fc26.src.rpm
rpmbuild -bb ~/rpmbuild/SPECS/netatalk.spec
rpm -ivh ~/rpmbuild/RPMS/x86_64/netatalk-3.1.10-0.1.1.el7.centos.x86_64.rpm

添加相关用户并设置登录密码

useradd time-machine
passwd time-machine

修改配置文件

cat >> /etc/avahi/services/afpd.service << EOF
<?xml version="1.0" standalone='no'?>
<!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>
EOF

cat >> /etc/netatalk/afp.conf << EOF
[Time Machine]
path = /home/time-machine
valid users = time-machine
time machine = yes
EOF

cat >> /etc/netatalk/afpd.conf << EOF
- -transall -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh
EOF

cat >> /etc/netatalk/AppleVolumes.default << EOF
/home/time-machine TimeMachine allow:time-machine options:usedots,upriv,tm dperm:0775 fperm:0660 cnidscheme:dbd volsizelimit:200000
EOF

cat >> /etc/nsswitch.conf << EOF
hosts:	files mdns4_minimal dns mdns mdns4
EOF

修改加防火墙设置

firewall-cmd --zone=public --permanent --add-port=548/tcp
firewall-cmd --zone=public --permanent --add-port=548/udp
firewall-cmd --zone=public --permanent --add-port=5353/tcp
firewall-cmd --zone=public --permanent --add-port=5353/udp
firewall-cmd --zone=public --permanent --add-port=49152/tcp
firewall-cmd --zone=public --permanent --add-port=49152/udp
firewall-cmd --zone=public --permanent --add-port=52883/tcp
firewall-cmd --zone=public --permanent --add-port=52883/udp
firewall-cmd --reload

添加启动服务

systemctl enable avahi-daemon
systemctl enable netatalk
systemctl start avahi-daemon
systemctl start netatalk

Mac上的设置, 在TimeMachine 设置选择配置好的备份盘就行
tm-1

tm-2

Post a Comment

Your email is never shared. Required fields are marked *

*
*