Installing Syncthing Sync Tool on CentOS

Publish: 2016-11-22 | Modify: 2016-11-22

Install Syncthing on CentOS

Syncthing is an open-source synchronization tool that supports version control and is available for various operating systems including Windows, Mac OS X, and Linux. It is similar to Resilio but has some differences. This article will guide you through the installation process of Syncthing on CentOS.

1. Download and Install

Installing Syncthing is straightforward. In this guide, we will use CentOS x64 as an example. If you need a different version for your client, please visit the Syncthing official website at syncthing. Now, let's execute the following commands:

### Download the client
wget http://soft.hixz.org/linux/syncthing-linux-amd64-v0.14.11.tar.gz
### Extract the files
tar -zxvf syncthing-linux-amd64-v0.14.11.tar.gz
### Enter the directory
cd syncthing-linux-amd64-v0.14.11
### Copy to the environment variable
cp syncthing /usr/local/bin/

Next, we need to run Syncthing once to generate the initial configuration file. Since we have added it to the environment variable, simply enter syncthing to run it. You will see the following output:

[root@xiaoz ~]# syncthing
[monitor] 20:37:05 INFO: Starting syncthing
[start] 20:37:05 INFO: Generating ECDSA key and certificate for syncthing...
[7NYBG] 20:37:05 INFO: syncthing v0.14.11 "Dysprosium Dragonfly" (go1.7.3 linux-amd64) [email protected] 2016-11-15 06:23:48 UTC
[7NYBG] 20:37:05 INFO: My ID: 7NYBGD4-AL5FI6M-6P5ULKJ-QSPFASO-T57T4QW-WETWQXT-CAGTJ2I-3PFQGQP
[7NYBG] 20:37:06 INFO: Single thread hash performance is 154 MB/s using minio/sha256-simd (95 MB/s using crypto/sha256).
[7NYBG] 20:37:06 INFO: Default folder created and/or linked to new config
[7NYBG] 20:37:06 INFO: Defaults saved. Edit /root/.config/syncthing/config.xml to taste or use the GUI
[7NYBG] 20:37:06 INFO: Ready to synchronize sxdwy-d7npj (readwrite)
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v4-2.syncthing.net/v2/?id=DVU36WY-H3LVZHW-E6LLFRE-YAFN5EL-HILWRYP-OC2M47J-Z4PE62Y-ADIBDQC
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v4-3.syncthing.net/v2/?id=VK6HNJ3-VVMM66S-HRVWSCR-IXEHL2H-U4AQ4MW-UCPQBWX-J2L2UBK-NVZRDQZ
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v4-4.syncthing.net/v2/?id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v6-2.syncthing.net/v2/?id=DVU36WY-H3LVZHW-E6LLFRE-YAFN5EL-HILWRYP-OC2M47J-Z4PE62Y-ADIBDQC
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v6-3.syncthing.net/v2/?id=VK6HNJ3-VVMM66S-HRVWSCR-IXEHL2H-U4AQ4MW-UCPQBWX-J2L2UBK-NVZRDQZ
[7NYBG] 20:37:06 INFO: Using discovery server https://discovery-v6-4.syncthing.net/v2/?id=LYXKCHX-VI3NYZR-ALCJBHF-WMZYSPK-QG6QJA3-MPFYMSO-U56GTUK-NA2MIAW
[7NYBG] 20:37:06 INFO: TCP listener ([::]:22000) starting
[7NYBG] 20:37:06 INFO: Completed initial scan (rw) of folder sxdwy-d7npj
[7NYBG] 20:37:06 INFO: Loading HTTPS certificate: open /root/.config/syncthing/https-cert.pem: no such file or directory
[7NYBG] 20:37:06 INFO: Creating new HTTPS certificate
[7NYBG] 20:37:07 INFO: GUI and API listening on 127.0.0.1:8384
[7NYBG] 20:37:07 INFO: Access the GUI via the following URL: http://127.0.0.1:8384/
[7NYBG] 20:37:07 INFO: Device 7NYBGD4-AL5FI6M-6P5ULKJ-QSPFASO-T57T4QW-WETWQXT-CAGTJ2I-3PFQGQP is "xiaoz" at [dynamic]
[7NYBG] 20:37:11 INFO: Automatic upgrade (current "v0.14.11" < latest "v0.14.12")
[7NYBG] 20:37:17 INFO: Detected 0 NAT devices

2. Modify the Configuration File

After running syncthing in the previous step, it successfully generated the corresponding configuration file. Press Ctrl + C to exit the client. Now, we need to modify the default configuration file using the command vi ~/.config/syncthing/config.xml. Modify the configuration around line 22, changing 127.0.0.1 to 0.0.0.0. Refer to the screenshot below:

Configuration File

3. Allow Port Access

Syncthing by default listens on port 8384. We need to allow this port through iptables. Enter the following commands:

### Allow port 8384
/sbin/iptables -I INPUT -p tcp --dport 8384 -j ACCEPT
/etc/init.d/iptables save
service iptables restart

4. Test Access

Run the syncthing command again to start the Syncthing client, then access it through your browser using http://your_server_ip:8384.

Syncthing Web Interface

Syncthing supports the Chinese language by default. Upon first login, you will be prompted to set a username and password. At this point, the basic setup is complete. You can explore how to add other devices and synchronize folders on your own.

5. Other Notes

If you want Syncthing to run in the background, you can use the nohup command: nohup syncthing &.

6. Conclusion

Syncthing allows synchronization between different devices and supports versioning. If you have the resources, you can use Syncthing to create your own private synchronization tool. This article is original content, please indicate the source if you wish to repost it.

This article is based on: Syncthing: 一个在计算机之间同步文件/文件夹的私密安全同步工具 Syncthing official website: https://syncthing.net/


Comments