How to install Syncthing on Fedora/RHEL using podman Quadlets
The Syncthing is the best Peer-to-Peer solution I've ever used. It is flexible, has clients for most platforms, decentralized, and open source. This guide will show you how to install it and use it for your Fedora. I'm lazy, so everything will be on top of podman
.
Install podman
If you are familiar with docker
, podman
is similar but with a more secure approach out-of-the-box. Let's install it:
sudo dnf install -y podman
Create the systemd service
Create the config dir:
mkdir -p ~/.config/containers/systemd/
Create the systemd container config dir
Create the container configuration file:
[Unit]
Description=Syncthing container
After=local-fs.target
[Service]
# Create the main directories
ExecStartPre=-/usr/bin/mkdir -p %h/Sync %h/containers/syncthing
# Always pull the latest version on boot
ExecStartPre=podman pull lscr.io/linuxserver/syncthing:latest
Restart=always
[Container]
ContainerName=syncthing
HostName=syncthing
Image=lscr.io/linuxserver/syncthing:latest
# if you know what you are doing, you can restrict even more the access
# using sub UID and GID inside the existent file system kernel namespace.
#Environment=PUID=%U
#Environment=PGID=%G
# The 0 (root) user on podman is your host limited user
# and this should already be enough for most cases.
Environment=PUID=0
Environment=PGID=0
Environment=Etc/UTC
Volume=%h/Sync:/data:z
Volume=%h/containers/syncthing:/config:z
PublishPort=8384:8384
PublishPort=22000:22000/tcp
PublishPort=22000:22000/udp
PublishPort=21027:21027/udp
[Install]
# Start by default on boot
WantedBy=multi-user.target default.target
$HOME/.config/containers/systemd/syncthing.container
Enable the service:
# DO NOT RUN AS ROOT
# Reload configs
systemctl --user daemon-reload
# Check if the container config is available
systemctl --user status syncthing.service
# Now, enable and start it
systemctl --user start --now syncthing.service
# Check if things are working
systemctl --user status syncthing.service
Create and enable the systemd service
If you want to go a bit deeper:
# You check the systemd generated files by running
/usr/libexec/podman/quadlet -dryrun -user
Debug systemd auto-generated files
From your browser, your should be able to reach the main page:
Create a new shared folder
The ~/Sync
directory is the place to put all your files. In your computer, it will be your user's home dir, and inside the container, it will be the /data/
dir.
So, if you want to have your files appearing inside the ~/Sync/music
in your computer, you must set the /data/music
in the Syncthing dashboard. Example below:
