How can I duplicate my Linux environment if I am migrating to different hardware?
I currently have packages, modules, settings, etc. for Eclipse, MySQL, Python, Firefox, etc. set up on Kubuntu. I have also optimally configured Kubuntu for my needs. I would like to duplicate my environment on another machine that has a different processor (currently on an Intel Q9450, the new processor is an i7). As I understand, my applications are compiled for use with my specific processor, so making a straight partition copy is out of the question.
Is there any way to duplicate my environment onto this other machine, short of re-installing and re-configuring everything?
As I understand, my applications are compiled for use with my specific processor, so making a straight partition copy is out of the question.
What leads you to this conclusion? At least for x86, the packages installed by Kubuntu are compiled to run on practically all non-prehistoric CPUs. I believe they will run on anything newer than a 486, which probably does not pose a problem in your case :-).
So a straight partition copy should work just fine:
- copy partitions (or just copy the files using
cp -a
, if your partition layout changed) - adapt /etc/fstab to new partition layout
- reconfigure bootloader for new partitions, and reinstall bootloader
- boot & enjoy
Problems are only to be expected for:
- self-compiled packages, but even there, most will by default compile for all modern CPUs, unless you play with compiler options
- device drivers
Most modern kernels autodetect hw on boot, so usually even drivers should be ok, but if things fail, you can usually boot in single-user mode and fix any driver issues.
You can take your home directory without any changes. Almost everything that goes into a home directory is designed to be sharable over something like NFS, so you are good.
Also, save your package selection with
sudo dpkg --get-selections '*' >file.txt
and restore it on the other machine with
sudo dpkg --set-selections <file.txt
Similarly, save your debconf settings with
sudo debconf-get-selections >file2.txt
and restore with
sudo debconf-set-selections <file2.txt
For the rest of the configuration in /etc
that is not managed by debconf, it is hard to track what was manually changed, unless you have used something like etckeeper (perhaps an idea for the future). For that reason, I tend to keep most of my configuration in my home directory. But since you know which programs you are interested in, it should be easy to find the relevant files in /etc
and check and copy them manually.
You can backup your home, and restore it to the other machine. This cannot fully fulfill your need, but it will restore all the configuration. You have to reinstall the packages yourself, though.
A vast majority of custom configurations will be in /home/, with most of the rest in /etc/. some of the /etc files have machine or hardware specific information (/etc/X11/xorg.conf, /etc/hostname, /etc/fstab off the top of my head), but much of it can just be copied over if you are going to be using the same OS version.