Keeping packages on Ubuntu fresh install
I am about to test migrating my Ubuntu installation to 64bit. I’ll test compatibility with my used applications first in a VM.
For that I installed Ubuntu 8.10 64bit Desktop edition into the VM. Since I don’t want to manually reinstall all packages by hand, I came up with the following aptitude / dpkg commands after reading a few other instructions:
On the source system, execute:
sudo aptitude search '~i !~M' -F '%p install' > packages-list
This will generate a list of all manually installed packages in packages-list. (All packages not installed as a dependency of another package.)
On the destination system execute:
sudo dpkg --set-selections < packages-list sudo apt-get update && sudo apt-get dselect-upgrade
This will install all the packages from the list. (and apt will take care of resolving dependencies)
That’s it. If you have already used a different method and want to fix things, read on:
If you just used a method involving dpkg --get-selections on the source system, you lost all information about automatically installed packages.
You can generate a list of all automatically installed packages on your source system:
sudo aptitude search ~M -F %p > autoremove-packages-list
and get the information into your destination system with:
sudo aptitude markauto `cat autoremove-packages-list`
Note that autoremove-packages-list is a filename.










