Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
RPI 3 Timemachine
# Hostname
echo "mnemosyne" | sudo tee /etc/hostname > /dev/null
sudo sed -i 's/raspberrypi/mnemosyne/g' /etc/hosts
# Fix locales
echo "LANG=\"en_GB.UTF-8\"
LC_ALL=\"en_GB.UTF-8\"" | sudo tee /etc/default/locale > /dev/null
# Optimizations
echo "gpu_mem=16" | sudo tee --append /boot/config.txt > /dev/null
# Rename default user 'pi' to 'alex'
# In order to change the username 'pi' we will have to log in a the root user since it's not possible to rename an account while your logged into it. To log in as root user first we have to enable it, to do so type the following command whilst logged in as the default pi user:
sudo passwd root
# Login, and edit this file:
sudo nano /etc/ssh/sshd_config
# Find this line: PermitRootLogin without-password
# PermitRootLogin yes
# reboot
sudo reboot
# Choose a secure password for the root user. You can disable the root account later if you wish.
# Now logout of the user pi using the command:
# And then logout back in as the user 'root' using the password you just created. Now we can rename the the default pi user name. The following method renames the user 'pi' to 'newname', replace this with whatever you want. Type the command:
usermod -l alex pi
# Now the user name has been changed the user's home directory name should also be changed to reflect the new login name:
usermod -m -d /home/alex alex
# If it works then you can disable the root account by locking the password:
sudo passwd -l root
# Wifi configuration
# setup netword informations
echo "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
}" | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf > /dev/null
wpa_cli -i wlan0 reconfigure
# disables wifi power save mode
sudo iw dev wlan0 set power_save off
# Build the last version of Netatalk
sudo apt update && sudo apt upgrade -y
sudo apt install \
hdparm \
build-essential \
libevent-dev \
libssl-dev \
libgcrypt-dev \
libkrb5-dev \
libpam0g-dev \
libwrap0-dev \
libdb-dev \
libtdb-dev \
libmariadbclient-dev \
avahi-daemon \
libavahi-client-dev \
libacl1-dev \
libldap2-dev \
libcrack2-dev \
systemtap-sdt-dev \
libdbus-1-dev \
libdbus-glib-1-dev \
libglib2.0-dev \
libio-socket-inet6-perl \
tracker \
libtracker-sparql-1.0-dev \
libtracker-miner-1.0-dev -y
tar -xf netatalk-3.1.11.tar.gz
cd netatalk-3.1.11
./configure \
--with-init-style=debian-systemd \
--without-libevent \
--without-tdb \
--with-cracklib \
--enable-krbV-uam \
--with-pam-confdir=/etc/pam.d \
--with-dbus-daemon=/usr/bin/dbus-daemon \
--with-dbus-sysconf-dir=/etc/dbus-1/system.d \
make && sudo make install
# Prepare disk
sudo parted /dev/sda mklabel gpt
sudo parted -a optimal /dev/sda mkpart Primary 0% 100%
sudo mkfs.ext4 /dev/sda1
# Active disk power save
echo "/dev/sda {
spindown_time = 240
}" | sudo tee --append /etc/hdparm.conf > /dev/null
# Prepare local directory to mount the disk
sudo mkdir /mnt/TimeMachine
echo "/dev/sda1 /mnt/TimeMachine ext4 defaults,noatime 0 2" | sudo tee --append /etc/fstab > /dev/null
sudo mount -a
sudo chown -R alex:pi /mnt/TimeMachine
# Configure afpd
echo "[Global]
mimic model = TimeCapsule6,106
log file = /var/log/netatalk.log
log level = default:warn
[Time Machine]
path = /mnt/TimeMachine
time machine = yes" | sudo tee /usr/local/etc/afp.conf > /dev/null
# Start services
sudo service avahi-daemon start
sudo service netatalk start
sudo systemctl enable avahi-daemon
sudo systemctl enable netatalk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.