Install and configure sync on CentOS 8 / CentOS 7

Synchronization is an open source continuous file synchronization used to synchronize files between two or more computers on a network. This tutorial is designed to help you install and configure Syncthing on a CentOS 8 / CentOS 7 Linux machine. Sync is easy to install, maintain, and provides an easy way to sync files between computers on your local area network and the Internet.

Core design principles for synchronization

Synchronization is built on the following core goals.

  • Prevent data loss – Protect user data by ensuring that user files are not damaged.
  • Easy to use – Synchronization should be approachable, easy to understand, and inclusive.
  • Protect against attackers – Do not make user data susceptible to eavesdropping or modification by unauthorized parties.
  • For individuals – Synchronization is mainly to give a single user a secure, reliable and easy-to-use file synchronization capability.
  • automatic – User interaction is required only when absolutely necessary.
  • Universally available – Sync should run on every regular computer.

Install Syncthing on CentOS 8 / CentOS 7

For CentOS and other RHEL Linux distribution families, no officially supported repositories provide RPM packages for installation. Therefore, we will download and install Syncthing on CentOS 8 / CentOS 7 from the official source archive.

Catch Latest release Synchronization of your operating system:

curl -s https://api.github.com/repos/syncthing/syncthing/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi -

Unzip the downloaded file.

tar xvf syncthing-linux-amd64*.tar.gz

Will have a binary file called Synchronize In the folder created by the extraction. Let’s copy the binary to / usr / local / bin table of Contents.

sudo cp syncthing-linux-amd64-*/syncthing  /usr/local/bin/

Verify that the binaries are copied by checking the synchronization version.

$ syncthing --version
syncthing v1.3.4 "Fermium Flea" (go1.13.7 linux-amd64) [email protected] 2020-01-14 07:01:03 UTC

Configure synchronization to start automatically at startup

We will use Linux Systemd to manage the Syncthing service-enabling users to start, stop, enable and disable service units.

Let’s create a new file.

sudo vi /etc/systemd/system/[email protected]

Paste the following into the file.

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target

[Service]
User=%i
ExecStart=/usr/local/bin/syncthing -no-browser -gui-address="0.0.0.0:8384" -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

Update the list of system services:

sudo systemctl daemon-reload

Enable and start the service.

sudo systemctl start [email protected]$USER
sudo systemctl enable [email protected]$USER

Confirm the service status.

$ sudo systemctl status [email protected]$USER
● [email protected] - Syncthing - Open Source Continuous File Synchronization for cloud/user
   Loaded: loaded (/etc/systemd/system/[email protected]; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2020-03-08 21:19:04 EAT; 1min 7s ago
     Docs: man:syncthing(1)
 Main PID: 7739 (syncthing)
    Tasks: 9 (limit: 11512)
   Memory: 29.1M
   CGroup: /system.slice/system-syncthing.slice/[email protected]
           └─7739 /usr/local/bin/syncthing -no-browser -no-restart -logflags=0

Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Loading HTTPS certificate: open /home/cloud-user/.config/syncthing/https-cert.pem: no su>
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Creating new HTTPS certificate
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: TCP listener ([::]:22000) starting
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) starting
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: GUI and API listening on 127.0.0.1:8384
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Access the GUI via the following URL: http://127.0.0.1:8384/
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: My name is "cent8.novalocal"
Mar 08 21:19:05 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Completed initial scan of sendreceive folder "Default Folder" (default)
Mar 08 21:19:20 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Detected 1 NAT service
Mar 08 21:19:36 cent8.novalocal syncthing[7739]: [BAMMV] INFO: Joined relay relay://85.10.202.70:22067

You can also use a separate user account to start the service by replacing $ USER With username.

Access sync interface

The synchronous management GUI is automatically started by systemd and is available on the configured listening address port 8384. in case -gui-address="ip:port" Option not provided, the service will be in https://localhost:8384/

$ sudo ss -tunelp | grep 8134
udp     UNCONN   0    0   [::]:35129  [::]:* users:(("syncthing",pid=260527,fd=16)) uid:1000 ino:4508134 sk:38 v6only:1 <-> 

By default, the Syncthing management interface is configured to allow passwordless remote access.

Open settings to set a password: Settings> GUI

Install and configure sync on CentOS 8 / CentOS 7

You will then be prompted for authentication.

Install and configure sync on CentOS 8 / CentOS 7

When accessing the Syncthing GUI, you should see the following interface:

Install and configure sync on CentOS 8 / CentOS 7

Synchronize data between two devices through synchronization

Enables you to synchronize data between two or more computers
Sync, make sure sync is installed and configured on all devices
system. After setup is complete, each device must be informed of other devices
device.

Sync Device ID

This is done by exchanging “Device ID“. One
The device ID is a unique encrypted security identifier. It is
Generated as part of key generation on first launch
Synchronization. If two devices are connected to each other and talk to each other,
Both are configured with each other’s device ID. Get device ID from Action> Display ID

Add sync device ID

To make two devices talk to each other, click “Add remote deviceAre in the lower right corner, Enter the device ID of the other party.

Install and configure sync on CentOS 8 / CentOS 7

and also, Select folder What you want to share. The device name is optional and purely decorative. You can change it later if needed. Click “save“The new device will appear on the right side of the GUI (though Disconnect), And a prompt is displayed, prompting you to restart.

Note: The shared default folder is ~Synchronize. After making changes like adding the Sync directory, make sure to restart Syncthing Action> Restart.

Good luck and have fun! there are more document If you run into trouble, feel free to Support Forum

Similar guides:

How to configure AWS S3 CLI for Ceph Object Gateway storage

Compress and deduplicate storage using Virtual Data Optimizer (VDO)

Setting up GlusterFS storage with Heketi on CentOS 8 / CentOS 7

Sidebar