Saturday, 17 October 2009

Saving a list of your Ubuntu packages and installing them again somewhere else

When you have to leave your old installation behind and have to move to a new installation of Ubuntu. You can install all the packages you used to have in 3 easy steps. Then you just need to copy over your home folder and voi-la your new installation is almost exactly like you used to have. On other operating systems this takes a week or so, and you keep on discovering things you forgot.

So for the packages you do on your old install:
dpkg --get-selections > installed-software

copy the installed-software file over to your new install and:
dpkg --set-selections < installed-software 
Like magic. And if you have a local apt-cacher-ng, you don't even need to download everything again. Alternatively you can copy over your /var/cache/apt/archives/ before doing the second part.

No comments:

Post a Comment