Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Time Machine service on CentOS 7
# Install Time Machine service on CentOS 7
# Updated for netatalk 3.1.10
# install required packages for compiling from source
yum install -y rpm-build gcc make wget
# install Perl-IO-socket dependency for netatalk 3.1.10
yum install -y perl-IO-Socket-INET6
# install netatalk
yum install -y avahi-devel cracklib-devel dbus-devel dbus-glib-devel libacl-devel libattr-devel libdb-devel libevent-devel libgcrypt-devel krb5-devel mysql-devel openldap-devel openssl-devel pam-devel quota-devel systemtap-sdt-devel tcp_wrappers-devel libtdb-devel tracker-devel
yum install -y bison docbook-style-xsl flex dconf
# updated url for netatalk 3.1.11
wget http://www003.upp.so-net.ne.jp/hat/files/netatalk-3.1.11-1.3.fc29.src.rpm
rpm -ivh netatalk-3.1.11-1.3.fc29.src.rpm
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
rpm -Uvh epel-release-7-11.noarch.rpm
yum install perl-interpreter
rpmbuild -bb ~/rpmbuild/SPECS/netatalk.specTh1spswdc0rrect
# If change user to root use correct path to your user home directory
rpm -ivh ~/rpmbuild/RPMS/x86_64/netatalk-3.1.11-1.3.el7.x86_64.rpm
# configuration
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">Server</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 = /opt/timemachine
valid users = tm
time machine = yes
EOF
cat >> /etc/netatalk/afp.conf << EOF
[Storage]
path = /opt/storage
valid users = tm
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
useradd tm
# Important to check the disk space at specified size (partition / can be smaller then you tought)
mkdir -p /opt/timemachine
mkdir -p /opt/storage
chown tm:tm /opt/timemachine
chown tm:tm /opt/storage
cat >> /etc/netatalk/AppleVolumes.default << EOF
/opt/timemachine TimeMachine allow:tm options:usedots,upriv,tm dperm:0775 fperm:0660 cnidscheme:dbd volsizelimit:800000
EOF
cat >> /etc/netatalk/AppleVolumes.default << EOF
/opt/storage Storage allow:tm options:usedots,upriv,tm dperm:0775 fperm:0660 cnidscheme:dbd volsizelimit:1000000
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 --zone=public --permanent --add-service=mdns
firewall-cmd --reload
systemctl enable avahi-daemon
systemctl enable netatalk
systemctl start avahi-daemon
systemctl start netatalk
# set password for tm user
passwd tm
# Useful Commands
# hostnamectl status
# hostnamectl set-hostname Serever --static
# hostnamectl set-chassis server
# hostnamectl set-icon-name network-server
# hostnamectl --pretty set-hostname "$(perl -CO -le 'print "\x{1f389}"')"
# hostnamectl --pretty status
# 🎉
# systemctl restart systemd-hostnamed
# /etc/netatalk/afp.conf
# [Global]
# ; Global server settings
# hostname = Server
# sudo vi /etc/avahi/avahi-daemon.conf
# host-name=Your Machine
# service avahi-daemon restart
# vi /etc/netatalk/afpd.conf
# add line at end of file
# "Your Machine"
# service netatalk restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment