Thursday 26 May 2011

How to generate a list of installed packages and use it to reinstall packages

This can be useful if you want to install a new machine with the exact same software as another one.
You can save your list of packages easily: see "man dpkg" and search for --set-selections and --get-selections.

The basic of it, though is that to save the list of packages:
dpkg --get-selections > package_list
To restore that list on another system:
sudo apt-get install dselect
sudo dselect update
cat package_list | sudo dpkg --set-selections && sudo apt-get dselect-upgrade
Moving across architectures means that there will be some packages unavailable. They will be ignored; for example, ia32-libs will not be installable on a 32-bit system. That selection will be ignored if you're moving from x86-64 to x86.

You call also skip packages that have version numbers in their names like this:
dpkg --get-selections | grep -vP '.*\d\.\d.*' > pkg_list
See also: http://www.arsgeek.com/2006/09/19/ubuntu-tricks-how-to-generate-a-list-of-installed-packages-and-use-it-to-reinstall-packages/

Possibly Related Posts

No comments:

Post a Comment