linux poison RSS
linux poison Email

Clone an Ubuntu Installation to Another Computer

dpkg is a tool to install, build, remove and manage Debian packages. dpkg itself is controlled entirely via command line parameters, which consist of exactly one action and zero or more options. The action parameter tells dpkg what to do and options control the behavior of the action in some way.

dpkg –get-selections:
First get list of package selections, and write it to a file.  Without a pattern,  non-installed  packages (i.e. those which have been previously purged) will not be shown in the file.
Use following command:
dpkg --get-selections | tee package_names

you need to save this file "package_names" somewhere so that we can retrive it when building the new system

dpkg –set-selections: 
Set package selections using file read  from  stdin.  This  file should  be in the format '<package> <state>', where state is one of install, hold, deinstall or purge. Blank  lines  and  comment lines beginning with '#' are also permitted.

Now go to the destination machine and run the following command providing the file name "package_name"
sudo dpkg --set-selections < ./package_names
Note - This command will not install any packages, but only mark a state corresponding to every package. For the actual installation, run the following command
sudo apt-get -u dselect-upgrade
This will install all the necessary packages and finally you should have the same source and destination system.


Post a Comment

Related Posts with Thumbnails