I frequently encounter the situation where i change laptop/desktop and when i install Ubuntu i have to install all my applications and restore settings.

Off-late i have been trying to write a bash script which would automate the installation and configuration.

Is there any other better way than writing a script. For e.g. Backup home folder, etc folder.


If you have everything installed from the standard repositories you can record your package selections with:

sudo apt-get install debconf-utils
sudo dpkg --get-selections '*' > selection.dpkg
sudo debconf-get-selections > selection.debconf

Then you can replicate that package selection on a fresh install with:

sudo debconf-set-selections < myselection.debconf 
sudo dpkg --set-selections < myselection.dpkg
sudo apt-get -u dselect-upgrade.

If you also backup your /etc, /home and other area where you have config or files that don't come from a package, you should be able to clone a machine pretty quickly.

This won't work if you are skipping between releases though, so instead I just keep a manual list of everything I install and all config that I change. If you keep this in an ordered way you can bring a new machine up to spec pretty quick anyway (and as you are doing things "manually" you can skip packages/steps that are no longer relevant so that you aren't carrying more cruft than you need to from one install to the other). I used such a list when I installed Ubuntu on my recent netbook purchase. Obviously you need the backup of /home and /etc as well but you should have good backups already anyway.


I haven't tested this myself yet, but you might be able to back up your home folder to Ubuntu One, then download it to the new machine. If you're reinstalling on the same machine, you might want to look into making /home a separate partition so it can persist through installs (which might also make backing it up easier).

As for applications, I prefer to download and install them from the repos each time, so a script is the best I've come up with so far (I think CrunchBang Linux comes with a script that will download, install, and configure certain things on first boot, so it might be worth looking at what they do; CrunchBang is Debian-based, so it should be easy to adapt), though I'm usually upgrading Ubuntu, which usually provides new versions of stuff in the repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.