Ubuntu – Sync settings/software on multiple machines

cronsync

I have the following scenario which I'm trying to solve:

I use 3 Computers, all of them are running Xubuntu (same LTS version). Now I am looking for a way to keep them in sync in terms of:
– installed Packages/Software
– Settings (Startup programs, Desktop, XFCE-bars (I REALLY FELL IN LOVE WITH THOSE!), etc.)
– Data

The reason for this are:
2 desktop machines in different houses, say A and B, and a laptop C which i dont want to carry to A or B for example. Or I need the computing power of a desktop machine for some bigger calculations which the laptop can not do.

Now, as for the third part (data) I have got an owncloud/seafile server running which keeps my stuff in sync, works nicely!

For the other two points I'm looking for a solution. I read about Ubuntu One, but if there is a solution without using someone elses services (also no Dropbox/Drive/… allowed) I would appreciate this!

If I could accomplish this employing for example my Raspberry Owncloud server, I would be very happy.

As an example, let's think of keeping just the xfce shortcuts and bars in sync: would it work if I just setup a folder sync for my
~/.config/xfce4/xfconf/xfce-perchannel-xml/
folder using my owncloud client? Or will there be complications due to the diferent hardware?

As for the software installed, could I create a cronjob that runs
dpkg --get-selections > <file>
which I sync via a synced folder to all other machines and run another cronjob that does

dpkg --set-selections < <file>
apt-get dselect-upgrade

to install all the packages?

Thanks for your help 🙂

Best Answer

You can use Unison File Synchronizer to synchronise the configurations folders. I use that to synchronise my user files and e-mail options and configuration folders.

Install unison: sudo apt-get install unison.

You would then need to create a profile inside folder ~/.unison

The file could be Synchronise_Profile.prf:

# Roots of the synchronization
root = /home/username
root = ssh://usrname@my.computer.com//home/username
#force = /home/username   # If you want to always override remote.
#batch = true  # If you do not want to have to confirm anything.

# Paths to synchronize
path = .config/xfce4/xfconf/xfce-perchannel-xml/
path = .config/xfce4/xfconf/   # And add any other folder to synchronize

# Some regexps specifying names and paths to ignore
ignore = Name temp.*  # Any files you may want to ignore
ignore = Name *~
ignore = Name .*~

More help on Unison File Synchronizer here.

It works through SSH so you can always make that work with SSH keys so you do not have to type passwords every time you synchronise. More on SSH keys here.

Of course, unison can work from the command prompt so once you set your SSH keys and ensure you have the backup folders working on the profile you can add this to a cron event and do this transparently.

Edit: Just realised that you are also looking for synchronising other installed files so this means this response is only partial as it would not ensure the software installed on one system is installed in another system.