Lsync is a lightweight syncing alternative to Rsync. It works roughly in the same way in that it scans a set directory for changes and syncs it to any place that the user wants. The application works as a background service and is readily available for installation on many mainstream Linux distributions. To get Lsyncd on Linux, open up a terminal window and follow the instructions that correspond to your operating system.
Note: be sure to install the app on all of the computers you wish to sync to.
sudo apt install lsyncd
sudo apt-get install lsyncd
Lsyncd is available for Arch Linux, though it’s not in the primary software sources, so installing it with the Pacman package management tool isn’t possible. Instead, those looking to use the Live Sync Daemon on Arch must download, build and set it up from the AUR.
To get the application working on Arch Linux, launch a terminal and follow the instructions below.
Step 1: Using Pacman, install both Base-devel and Git. These packages are essential, and you will not be able to interact with the Lsyncd AUR package without them.
sudo pacman -S git base-devel
Step 2: Clone the latest Lysncd AUR snapshot from the official Arch Linux User Repository website.
git clone https://aur.archlinux.org/lsyncd.git
Step 3: Change the terminal’s starting directory from the home folder to the newly cloned “lsyncd” directory using the CD command.
Step 4: Compile and generate an installable package for your Arch Linux PC by executing the makepkg command. Please note that when you’re using makepkg, the package may fail to build. If this happens, refer to the Lsyncd AUR page and read the user comments for guidance.
sudo pacman -S lsyncd
sudo zypper install lsyncd
Can’t find Lsycnd for your Linux operating system? If so, you may need to download the program and build it from source. Open up a terminal and follow the step-by-step instructions to learn how to get Lsycnd built and running.
Step 1: The app has a lot of dependencies that must be installed. Check the list below and grab each of these packages.
- Lua (5.2 or later)
- Liblua (5.2 or later)
- GCC compiler
- Lua compiler
More information on needed dependencies can be found on GitHub.
Step 2: Use Git and clone the source code to your Linux PC.
git clone https://github.com/axkibe/lsyncd.git
Step 3:Move into the Lsyncd code folder with the CD command.
Step 4: Make a new build directory in the code folder.
Step 5: Move the terminal session into the new build directory.
Step 6: Run cmake to start the code compilation process.
Step 7: Finish up the compilation process with the make command.
Step 8: Install the app to your Linux computer with make install.
sudo make install
The Lsyncd service runs in the background. Unfortunately, the service doesn’t start up and enable itself manually. As a result, before we can interact with Lsyc, we must start the background service using the systemctl command.
sudo service lsyncd start
With the service started, we can make a new configuration file using the touch command.
sudo touch /etc/lsyncd.conf
Please note that on some operating systems, creating a file at /etc/lsynd.conf may not work. It may be necessary to create a configuration file in /etc/lsyncd/ instead.
sudo mkdir -p /etc/lsyncd/ sudo touch /etc/lsyncd/lsyncd.conf.lua
Open up the configuration file with the Nano text editor.
sudo nano /etc/lsyncd.conf
Or, if you set the configuration in /etc/lsyncd/, do:
sudo nano /etc/lsyncd/lsyncd.conf.lua
Paste the code below into the configuration file:
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.stat",
statusIntervall = 1,
nodaemon = false
After the code is in the Nano text editor, save it by pressing the Ctrl + O keyboard combination. Then, exit it with Ctrl + X.
Set up shared folder
Now that the core of the configuration folder is set up, we need to set up a syncing system. To set up a syncing system, go back to Nano and paste the code in lsyncd.conf, directly below what was added earlier.
Note: be sure to go through the sync code and change it so that it suits your needs.
source = "/source/folder/location",
host = "remote-pc-or-server-ip",
targetdir = "/remote/directory"
Once again, save the edits to the lsyncd.conf folder in Nano with Ctrl + O.
Start the sync
Lsync is all set and ready to go. Now it’s time to start the synchronization process. In a terminal, use the service command to restart it.
sudo service restart lsyncd
By rebooting Lsync with the service command, it’ll read the new configuration file and instantly start syncing data.