Syncthing Installation

About Proxmox #

Syncthing is a continuous file synchronization program. It is a file level replication service that synchronizes files between two or more computers in real time. In addition to the command line interface, Syncthing has a web ui from which you can manage various options, configure shares and sync schedules.

This post looks a how you can install Syncthing on a Ubuntu server. In my case, I am doing this on an LXC container running Ubuntu Server 2022-04.

Installing Syncthing #

Lets begin by verifying that curl and gpg are installed with the following command,

sudo apt update && sudo apt install curl gpg -y

Next, we will add the Syncthing repository’s GPG (GNU Privacy Guard) key using the following command. This is required so that we can download Syncthing.

curl -s https://syncthing.net/release-key.txt | sudo gpg --dearmour -o /usr/share/keyrings/syncthing.gpg

Next, we will add Syncthing stable repository into the local apt database with the following command,

echo "deb [signed-by=/usr/share/keyrings/syncthing.gpg]  https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

Next, lets perform an update of our apt database with the following command,

sudo apt update

With all our apt repository information updated, we can now finally install Syncthing using the following command,

sudo apt install syncthing

Finally, let us enable the Syncthing service and start it using the following commands. Enabling the service will ensure that Syncthing starts up automatically after a system reboot. Replace username with your username.

sudo systemctl enable syncthing@username.service
sudo systemctl start syncthing@username.service

You can verify that the service is running using the following command. Replace username with your username.

sudo service syncthing@username status

Allowing Enternal Access #

By default Syncthing only allows access to the GUI from localhost (127.0.0.1). If you are installing Syncthing on a server then you would need to modify the configuration file to access the GUI from a remote machine.

Open a terminal window and edit the configuraiton file located at $HOME/.config/syncthing using vi or nano using the command

nano $HOME/.config/syncthing/config.xml

Navigate to the following section on the file,

    <gui enabled="true" tls="false" debugging="false">
        <address>127.0.0.1:8384</address>
        <apikey>SomeKey</apikey>
        <theme>default</theme>
    </gui>

Modify the address to 0.0.0.0:8384 to allow remote connections from all hosts,

    <gui enabled="true" tls="false" debugging="false">
        <address>0.0.0.0:8384</address>
        <apikey>SomeKey</apikey>
        <theme>default</theme>
    </gui>

Save the file and restart the Syncthing service using the command. Replace username with your username.

sudo service syncthing@username restart