Chapter 15:

SYNCING FILES

Syncing Files Across Multiple Devices with Syncthing

With Syncthing, you can effortlessly synchronize files across various devices, including mobile devices, desktop computers, file servers, and more, without the hassle of manual updates. Follow these steps to install and configure Syncthing:

Step 1: Add Syncthing Repository

To install Syncthing, add its repository and update the package list:

curl -s https://syncthing.net/release-key.txt | sudo apt-key add - echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

sudo apt update

Step 2: Install Syncthing

Install Syncthing using the following command:

sudo apt install syncthing

Step 3: Start Syncthing

After installation, start Syncthing:

syncthing

Wait until you see the following message indicating that Syncthing has joined a relay:

[Z24PT] 16:34:52 INFO: Joined relay relay://77.70.78.148:22067

Step 4: Modify Syncthing Configuration

Edit the Syncthing configuration file:

sudo nano ~/.config/syncthing/config.xml

Locate the following section in the config.xml file:

<gui enabled="true" tls="false"> <address>127.0.0.1:8384</address> <apikey>xu2Y-Ian-jVkADUWCPZxgVfBd0mQ7TDX</apikey> </gui>

Change the "127.0.0.1" to "0.0.0.0" like this:

<gui enabled="true" tls="false"> <address>0.0.0.0:8384</address> <apikey>xu2Y-Ian-jVkADUWCPZxgVfBd0mQ7TDX</apikey> </gui>

Step 5: Set Up Systemd Service

Download the Syncthing systemd service file:

sudo wget https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-systemd/system/syncthing%40.service -O /etc/systemd/user/syncthing@.service

Step 6: Enable and Reboot

Enable the Syncthing service and reboot your Raspberry Pi:

sudo systemctl enable syncthing@pi.service

sudo reboot

Step 7: Access Syncthing GUI

You can access the Syncthing GUI by opening a web browser and navigating to:

http://ip-of-your-raspberry-pi:8384

Now, you have successfully set up Syncthing to synchronize files across your devices. You can find more detailed information in the source article here.