How To Install Syncthing on Ubuntu 24.04 LTS
What is Syncthing?
Syncthing is a continuous file synchronization program that operates on a peer-to-peer (P2P) network. Unlike cloud-based solutions like Nextcloud, Syncthing doesn’t rely on central servers. Instead, it allows you to synchronize files between multiple devices in real-time, ensuring your data is consistent across all your machines.
Security is a primary focus; Syncthing encrypts all communication using TLS, protecting your data from unauthorized access. You have complete control over where your data is stored and with whom it is shared, making it a safe and private solution for file synchronization. Syncthing is available on various platforms, including Linux, Windows, macOS, and Android. It offers a flexible solution for maintaining consistent files across different operating systems.
Syncthing stands out as a robust alternative to other synchronization tools like Resilio Sync (formerly BitTorrent Sync). Its open-source nature and decentralized approach provide enhanced control and security over your data.
Prerequisites
Before we begin the installation process, make sure you have the following prerequisites in place:
- An Ubuntu 24.04 LTS system.
- A user account with
sudo
privileges. - A stable internet connection.
It’s also a good idea to update your system to ensure you have the latest packages. Open your terminal and run the following commands:
sudo apt update && sudo apt upgrade -y
This command updates the package lists and upgrades any outdated packages on your system, setting the stage for a smooth Syncthing installation.
Adding the Syncthing Repository
Syncthing is not typically included in the default Ubuntu repositories. This means we need to add the official Syncthing repository to your system’s APT sources. Adding the repository ensures that you receive the latest versions and updates directly from the Syncthing developers.
First, install the necessary dependencies required to add and manage external repositories:
sudo apt install gnupg2 curl apt-transport-https -y
These packages provide the tools needed to handle GPG keys and access repositories over HTTPS. Next, download and add the Syncthing GPG key to your system. This key verifies the authenticity of the packages you’ll be installing:
curl -fsSL https://syncthing.net/release-key.txt | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/syncthing.gpg
Now, add the Syncthing repository to your APT sources list:
echo "deb https://apt.syncthing.net/ syncthing release" | sudo tee /etc/apt/sources.list.d/syncthing.list
Finally, update the repository index to include the new Syncthing repository:
sudo apt update
With the repository added and updated, your system is now ready to install Syncthing.
Installing Syncthing
With the Syncthing repository successfully added, the next step is to install Syncthing itself. Run the following command in your terminal:
sudo apt install syncthing
This command fetches and installs Syncthing along with any required dependencies. Once the installation is complete, verify it by checking the Syncthing version:
syncthing --version
The output should display the installed Syncthing version, confirming that the installation was successfu. For example:
syncthing v1.27.3 "Gold Grasshopper" (go1.21.6 linux-amd64) [email protected] 2024-01-15 03:45:19 UTC [noupgrade]
Configuring Syncthing as a Systemd Service
To ensure Syncthing runs reliably and starts automatically on boot, it’s best to configure it as a systemd service. Systemd is the system and service manager for Linux, providing a way to manage background processes.
Enable Syncthing to start on boot using the following command. Make sure to replace username
with your actual username:
sudo systemctl enable syncthing@username.service
Start the Syncthing service:
sudo systemctl start syncthing@username.service
Check the status of the Syncthing service to ensure it is running correctly:
sudo systemctl status syncthing@username.service
The output should indicate that the service is active and running. If there are any errors, check the systemd logs for more details. Syncthing’s configuration files are stored in /home/username/.config/syncthing/
, and the default synchronization folder is /home/username/Sync
. Make sure these directories exist and are accessible by your user.
Accessing the Syncthing Web Interface
Syncthing provides a web interface for managing your synchronization settings. By default, the web interface is accessible only from the local machine. To access it, open your web browser and navigate to http://localhost:8384
or http://127.0.0.1:8384
.