Pi OS 12 Pi 4 - BYO-NTP/recipes GitHub Wiki

date server os
2025 Raspberry Pi 4 Pi OS 12

Install OS

Use the Raspberry Pi imager to install Raspberry Pi OS Lite (64-bit) to a SD card. Configure the imager to add your login account and SSH key. Then insert the SD into the Pi 4 (or 5).

Note: it is normal for the Pi to reboot several times as it configures itself.

Configure

remote login

ssh pi4
sudo su -
# customize this!
cat ~MY_USERNAME/.ssh/authorized_keys > ~root/.ssh/authorized_keys
exit; exit  # disconnect
ssh root@pi4

serverize

Set your Pi's FQDN:

systemctl stop systemd-hostnamed
systemctl disable systemd-hostnamed
hostname pi4.example.com

Cheat, and do everything below here with a lot less copy/paste!

curl -sS https://byo-ntp.github.io/tools/pi5/install.sh | sh
curl -sS https://byo-ntp.github.io/tools/zsh/install.sh | sh

Make it permanent:

echo $(hostname) > /etc/hostname

echo "
Welcome to $(hostname)!
" > /etc/motd

Update

apt update && apt -y upgrade
apt autoremove -y

Optimize

We're about to have Stratum 1, we have no use for timesyncd:

systemctl disable systemd-timesyncd.service

If you aren't using bluetooth, disable it entirely.

for i in alsa-state bluetooth triggerhappy hciuart; do
	systemctl stop $i.service; systemctl disable $i.service
done

apt purge -y bluez bluez-firmware modemmanager
grep -q '^dtoverlay=disable-bt' /boot/firmware/config.txt \
  || echo 'dtoverlay=disable-bt' >> /boot/firmware/config.txt

If you aren't using Wifi, banish it too:

apt purge -y wpasupplicant
grep -q '^dtoverlay=disable-wifi' /boot/firmware/config.txt \
  || echo 'dtoverlay=disable-wifi' >> /boot/firmware/config.txt

Disable audio too:

grep -q audio=on /boot/firmware/config.txt \
  && sed -i -e 's/audio=on/audio=off/' /boot/firmware/config.txt

Since this is a server with a static IP, we don't need Zeroconf:

systemctl disable avahi-daemon.service
systemctl stop avahi-daemon.service
apt purge -y avahi-daemon
apt autoremove -y

For a great shell, try a well-configured zsh + starship:

curl -sS https://byo-ntp.github.io/tools/zsh/install.sh | sh

References

⚠️ **GitHub.com Fallback** ⚠️