Geekosopher

Yet Another Blog by Nitesh Mistry

Entries tagged "dpkg"

Cloning Debian Installation
15th September 2010

There have been many times when I made a fresh installation of a Debian or Debian-based OS on a new computer or a different partition of my hard-disk and asked - how could I install all the other packages that I have installed on my main system in one go. Many answers involve remastersys, aptoncd, etcetera, etcetera. But they are helpful only when I want to install the same release of the distro. What if I upgraded my distro to the latest release? After every time I upgrade my system, I want to install all the packages that I had additionally installed on my older system.

The answer to this question always eluded me until recently when I read this article. And the solution was right there in my system itself, without the need for any external program. Not that I was completely ignorant of this solution, but I was not able to put it all together.

I am tempted to explain the whole thing here again, but the author of the original article has put it very descriptively. So I am going to only list the commands here:

Step 1 - On the system you want to copy from

sudo apt-get autoremove

Step 2 - Again on the system you want to copy from

dpkg --get-selections > installed-packages

A new file by the name of "installed-packages" will get saved in the home directory. Copy this file to the new system on which you want to install all the packages.

Step 3 - On the new system

sudo dpkg --set-selections < installed-packages
sudo apt-get dselect-upgrade

Note: Before you proceed with Step 3 - If the original system had some packages installed from third party repositories, add those repositories to the new system's /etc/apt/sources.list file. If you don't do this, those third party apps will not get installed. Also copy the /etc/apt/trusted.gpg file from the original system if you don't want to import gpg keys of all third party repositories from their websites.

That's it and you are done! Kewl B-)

Email comments to Nitesh Mistry   Tags: debian, dpkg, geekosophy, howto, install, linux.