Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I want to format my system, but I don’t want to lose my updates and installed packages. I also want the same packages on other systems as well.

share|improve this question

marked as duplicate by vasa1, Thomas Ward, Kevin Bowen, Mitch, Seth Aug 25 '13 at 16:43

This question was marked as an exact duplicate of an existing question.

Backing up should be:

dpkg --get-selections > ~/Package.list
sudo cp /etc/apt/sources.list ~/sources.list
sudo apt-key exportall > ~/Repo.keys

and restoring should be

sudo apt-key add ~/Repo.keys
sudo cp ~/sources.list /etc/apt/sources.list 
sudo apt-get update
sudo apt-get install dselect
sudo dpkg --set-selections < ~/Package.list
sudo apt-get dselect-upgrade -y

...If I'm not mistaken.

share|improve this answer

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