On 17Dec2021 10:26, linux guy <linuxguy123(a)gmail.com> wrote:
These days I find myself constantly going back and forth between
working on
my laptop and working on my desktop computer. It is very tiring setting up
the same applications twice, moving files back and forth etc.
I would like to find a way to keep my laptop and desktop computers
perfectly sync'd. Same applications installed, same setup, same files,
everything.
There are a few aspects to this:
- installed packages
- personal files
- dev files
I used to maintain a small fleet of RedHat servers, and had a couple of
scripts for package comparison:
https://hg.sr.ht/~cameron-simpson/css/browse/bin/yum-missing
https://hg.sr.ht/~cameron-simpson/css/browse/bin/rpm-comparehost
You moight need to replace the command "yum" with "dnf" these days,
but
they should help. In particular rpm-comparehost has a --yum option to
install missing packages.
Personal files:
I have a script "putacc" I use to drop my primary persoanl stuff onto
other machines - this is config files and related stuff. It assumes you
have a "primary" - for me this is my laptop. But given that, I routinely
go "putacc host1 host2 host3 ..." after I've updated something. It uses
ssh and rsync, so "host1" etc is just an ssh Host clause name.
For example, if I record new account credentials in my GPG-encrypted key
store, I go "putacc home borg" to put it on the home and local servers.
putacc/synacc run from a core list of files (an "rsync --files-from"
file) and a per-host list - the key store is only present in the home
and borg per-host lists, not the other hosts. SO there's a limited
degree of customisation available. I've been doing this for years.
Dev files: Mercurial or Git repos. Then you've only got to go "hg fetch"
or "git pull" in a work area before continuing and the updates from
upstream will be pulled in.
Finally, there's a bunch of pretend shared filesystem things you can
use:
1: Things like Dropbox or SyncThing will sync folders between machines.
Sometimes a little clunky.
2: sshfs: I keep a few things from the home server mounted on the laptop
using sshfs. The files are not local, but I can cd in there and do
things, and the changes apply to where they're stored. If you're remote
with poor internet cding etc and editing text files works quite well
still, doing things with large files will be infeasible due to
bandwidth.
If you've got a VPN you can use NFS and SMB/CIFS too. Sshfs is more
flexible, though a clunkier approach in theory.
3: backups: I've got arun-backups script to back up specific stuff from
a host to wherever. A combination of image backups (plain rsync onto the
backup image) and histbackup (rsync with history).
Cheers,
Cameron Simpson <cs(a)cskk.id.au>