Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install Time Machine service on CentOS 7
# Install Time Machine service on CentOS 7
yum install -y rpm-build gcc make wget
# 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
rpm -ivh netatalk-3.1.7-0.1.fc22.src.rpm
rpmbuild -bb ~/rpmbuild/SPECS/netatalk.spec
rpm -ivh ~/rpmbuild/RPMS/x86_64/netatalk-3.1.7-0.1.el7.centos.x86_64.rpm
# configuration
cat >> /etc/avahi/services/afpd.service << EOF
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<name replace-wildcards="yes">%h</name>
cat >> /etc/netatalk/afp.conf << EOF
[Time Machine]
path = /opt/timemachine
valid users = tmbackup
time machine = yes
cat >> /etc/netatalk/afpd.conf << EOF
- -transall -uamlist,, -nosavepassword -advertise_ssh
useradd tmbackup
mkdir -p /opt/timemachine
chown tmbackup:tmbackup /opt/timemachine
cat >> /etc/netatalk/AppleVolumes.default << EOF
/opt/timemachine TimeMachine allow:tmbackup options:usedots,upriv,tm dperm:0775 fperm:0660 cnidscheme:dbd volsizelimit:200000
cat >> /etc/nsswitch.conf << EOF
hosts: files mdns4_minimal dns mdns mdns4
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
# set password for tmbackup
passwd tmbackup
Copy link

meoow commented Sep 28, 2015

CentOS7, after rpm -ivh netatalk-3.1.7-0.1.fc22.src.rpm
no ~/rpmbuild/SPECS/netatalk.spec at all.

Copy link

meoow commented Sep 28, 2015

my mistake, I used sudo to run rpm.

Copy link

meoow commented Sep 28, 2015

One more thing, based on ArchLinux wiki, netatalk 3.x uses /etc/netatalk/afp.conf only, afpd.conf and AppleVolumes.default are used by netatalk 2.x, so it seems unnecessary to create the later two files in your script.

Copy link

jamesfawcett commented Nov 4, 2015

Great script, thank you for sharing! To get this working on a Centos 7 Minimal, the only change i had to make was on line 70:

systemctl enable avahi-daemon.service

And all fully working, thanks for sharing!

Copy link

oneshot719 commented Jun 7, 2016

Copy link

ghost commented Mar 1, 2017

Copy link

Stormwind99 commented May 4, 2017

Thanks all! This helped me get the newer netatalk working for my wife's Time Machine backups.

Copy link

Comnenus commented May 31, 2017

I compiled the src rpm on a centos 7 machine and installed it on the time machine host, another centos 7 machine. Everything worked fine -- anybody know why a regular rpm for netatalk is not available?

Copy link

aidmax commented Jun 12, 2019

Copy link

hrabiamiod commented Apr 7, 2020

updated for netatalk 3.1.12-10 & backup patch change to /home when this fs is bigger:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment