How to sync Ubuntu/software/configurations between N computers with free software and/or without a cloud? [closed]
Note: this question is not about syncing data in a Dropbox-like way (files, folders), it is more about syncing configurations.
I would like to have exactly the same version of Ubuntu with all the software installed and configured both on my Desktop PC and on my Laptop PC (and maybe on my small netbook PC) without using Ubuntu Sync and with minimal maintenance effort (setup once, run for a long time).
The use case is the following:
-
I work on my Laptop PC and do some changes to software configuration, for example:
- configure vim to have a new plugin
- update the Search Tracker / Recoll file search index
- configure Thunderbird to have an additional IMAP account ('remember password')
- add some new bookmarks in Firefox/Chrome
- change the desktop background image
- install new software with
apt-get install
- build and install new software with
checkinstall
- etc.
I do some 'sync' operation
- I switch to my Desktop PC and get all the changes from
(1)
working on the Desktop PC -
I work on my Desktop PC and do some changes to software configuration, for example:
- add new directory to the list of directories to be backed up by DejaDup
- add a new check spelling dictionary to the Libreoffice Writer
- configure the Terminator software to have colored fonts
- install new font into the Ubuntu system
- configure Ekiga to make phone calls
- etc.
I do some 'sync' operation
- I switch to my Laptop PC and get all the changes from
(1)
and(4)
working on the Laptop PC.
Question: What free/open-source software can I use to sync both machines' Ubuntu systems, installed software and configurations? Is it possible to do that without any cloud services?
Complementary question: It is obvious that the Desktop PC and the Laptop PC have different hardware configurations. How does the 'sync software' in question deal with video drivers, wlan drivers and their configurations?
Note: I do not need all the PCs to be synced at the same time, because I work with only one single machine at once.
Note: I considered to use Chef to solve the problem, but it seems that it might be really cumbersome to maintain such a setup.
Note: I also considered using a bootable USB with Ubuntu installed (portable Linux), but I am not sure that the video drivers will work then.
As far as I understand it your intentions are:
- Sync the installed applications
- Sync your work
- Sync your dotfiles (configuration)
Whatever you do, you will need some sort of cloud service. It doesn't have to be Dropbox. I highly recommend Seafile. I run it on Raspberry Pi at home for my syncing needs. Their documentation is easy to follow.
1. Application Synchronization
Until 13.10 this was an out-of-the-box feature. Today I would use Ansible or other configuration management solutions (like puppet or chef). The Anible Playbook specifies what you want to have installed. You can use Seafile to keep that synced and use a cron job to run Ansible.
2. Sync your work
Here I would definitely use Seafile. It allows you to sync any folder of your chosing and doesn't confine you to a single Dropbox-like folder.
3. Dotfiles
You can of course sync these with Seafile. An even better option would be to put all your dotfiles under git version control. You can join the crowd and put your dotfiles on github or use your own server as an intermediary. Some basic knowledge of git is of course required.
You could move your home directory to a flash drive. That is where most programs store their configuration and compiled programs can be installed there using ./configure --prefix=/home/YOURNAME/bin
(or any other directory). The only thing that does not work doing that is automatically syncing packages installed with apt-get.
For that install synaptic and before clicking the check to install those packages click "save markings as..." that will allow you to save a list of all of the packages that will be installed. When you get on your laptop run synaptic and then use "read markings" to get a list of the files you need. Then click the check to install the same files on your other computer.
This solution will not have any problems with drivers since the OS itself is not shared, only configuration, user files, etc. If you don't want to move all of your files around on the flash drive then you can store them in another folder (like /home/myfiles), which doesn't have to have a user associated with it.
If this is what you want to do then you must follow these steps:
- Copy your home folder's contents to the flash drive.
- Remount the flash drive to your home folder's location.
- Add the flash drive to the file /etc/fstab with the mount point being at your home folder.
What this will do is when your computer is booted with the flash drive present Ubuntu will start normally but treat the flash drive as if it were your normal home folder. If the computer complains that the flash drive is non-bootable then you can change your bios settings to stop booting from a flash drive by moving the flash drive option down the list to below hard drives.
If you need help doing any of those you can ask in a comment. Also you can't remove the flash drive while the computer is running because unmounting it would mean removing your home folder from the system.
Here is a detailed list of the steps above:
Before starting:
The flash drive isn't really ready to be used, it could technically be used as is but that isn't a great idea. Most flash drives use fat32 which is compatible with Linux, and also everything else, but doesn't support most of Linux's features so it should be changed to ext2, ext3/4 could be used but the journal can damage flash drives, but it does protect files in a power outage, so if you want to discuss this first you can leave a comment.
As a note Ext only works on linux, but this wouldn't share settings between non-Linux computers anyway so if you need this to work cross-platform then only user files will be shared (and the partition won't be able to be Ext), but if this is only for Linux, and only for one Desktop Environment (on every computer you are using) then it will work fine. (it's difficult to get different desktop environments to share settings even on the same computer)
Open Disk Utility (it should be accessible using the launcher), you will need to enter your password. Then select the flash drive, note down the device in the top right corner (it should look like /dev/sdb or something similar). Then click "Unmount Volume".
Then click "Format Volume" the most important thing about this is that everything on the flash drive will be erased. On the menu that comes up click the type dropdown and select Ext2, or whatever filesystem you choose (tell me if you choose another since the mount and fstab need to know the type). Click the format button and wait for it to finish.
Step 1:
This is the easiest, insert the flash drive in each computer and run type in cp -r /home/USER /mount/FLASHDRIVE
where user and flash drive are the locations of your homefolder and the flashdrive. This will also work on hidden files (which as I mentioned are important). The most difficult part of this is that files with the same name will be over written, so make sure that the last computer you use is the one with the settings that you want the most. Also for the test coming up add a file called It Works
, it doesn't have to contain anything.
Step 2: You should probably skip this step
I didn't really think about how involved this would be when I was writing the original response. When I tested it on my computer it didn't work and it's not really necessary and weird things will happen to your computer while you are running it, that will probably confuse you.
This only has to be done on one computer as a test to make sure everything works. Run sudo umount /dev/sdXY
where XY is the device you got earlier followed by 1 (so if it was /dev/sdb write /dev/sdb1). Then run these commands:
sudo shutdown now
mount -t ext2 /dev/sXY /home/USER
telinit 5
Shutdown doesn't actually turn off the computer it puts you in single user mode so you can deal with the filesystems without them being used, you will be logged out though so don't be alarmed when the system changes completely.
Then log in and your home folder should be the flash drive at this point. If the file created earlier is now in your home folder then the home folder must be the flash drive, so then you can move on to the next step. If not leave me a comment.
Step 3:
This one has to be done on each computer run sudo gedit /etc/fstab
. Then switch to the text editor that appeared. (if you are using KDE you should replace gedit with kate or whatever text editor you use. Then add this line to the bottom of the file replacing the parts in ALL-CAPS as necessary.
/dev/sdXY /home/USER ext2 errors=remount-ro 0 1
Where XY is the device you got earlier followed by 1 (so if it was /dev/sdb write /dev/sdb1)
At this point restart the computer and the flash drive should have replaced your old home folder, with all of the settings saved to the drive and all of the files that were on the drive being in your home folder. You should check for the "It Worked" file in your home folder to be sure.