Ubuntu – How to back up the ubuntu packages/settings/etc so that it can be restored from a clean install


I need to reinstall Ubuntu, but it doesn't have anything to do with wanting to clean my system or 'start fresh.' I have my stuff pretty fine tuned, so I want to redo as little as possible.

Best Answer

In brief

  1. Backup you $HOME or whatever partition, logical volumes that contains your personal data
  2. Get a list of the installed packages dpkg --get-selections > pkg.list keep the file
  3. When restoring the packages sudo dpkg --set-selections < /path/to/pkg.list and sudo apt-get dselect-upgrade
  4. Backup your /etc if you can't remember what changes you have made for tuning

You can use tar or rsync over SSH to a remote host. I personally recommend booting using a USB/DVD Live (e.g. Ubuntu Desktop or System Rescue CD) and do the backup just to avoid file lock issues, always safer;-)

Related Question