Create package.list backup (Debian)

From radio.javaranch.com

I accidentally broke my installation quite badly, but luckily I had some settings and other bits and pieces ready for just this occasion. Note that the following is for Debian based systems!

Step One – Get a list of installed packages

Once you have your machine set up more or less as you want it, export the list of installed packages to a file like this:

dpkg --get-selections > package.list

Step Two – keep the list safe!

Keeping the list safe is more important than keeping it up to date. I keep mine in my DropBox account with a few other essential items. Using DropBox means I can grab the file via the web if I need it in a hurry. Not much point if I needed to install DropBox before I could access the file!

Step Three – Recover the Backup

Bring everything back in one massive update if things go wrong:

sudo dpkg --set-selections < package.list sudo apt-get dselect-upgrade

Warning, the final step will probably take some time to finish, and while it is pretty good it won't be perfect - you may want to include your apt sources in DropBox too. Personally I find it preferable to the manual option.

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....