-   Ubuntu (
-   -   clone an installation (

sulekha 09-27-2007 01:32 AM

clone an installation
Hi all,

i was reading the book "Ubuntu Hacks" published by O Reilly. in this book there is section named "How to clone an installation"

it is given as below

Hack 80. Clone an Installation

Export a list of installed packages on one Ubuntu system, and import them into another to build a duplicate system.
We've installed many different Debian-based distributions over the years, and one thing we've found handy to have is a complete list of packages you have installed. If you want to create a system that is similar to a different system you have already set up, it can be difficult to remember each and every package you had installed. In this hack, we cover a method to export your current package list and import it into a new system.

This method works best when you are exporting to and importing from the same distribution and, specifically, the same releasefor example, exporting from Ubuntu Dapper to Ubuntu Dapper. Because of the differences in package versions and dependencies across releases, and especially across distributions, you will have substantially more headaches with conflicting packages if you try to export, say, from Ubuntu Breezy to Ubuntu Dapper or, worse, vice versa.

Export the List of Installed Packages
The first step in cloning an installation is to grab the complete list of installed packages from the first system. To do so, you basically instruct dpkg to dump its entire list of packages, filter out any packages that aren't currently installed, and then redirect the output to a file:
$ sudo dpkg --get-selections | grep '[[:space:]]install$' | \\
awk '{print $1}' > package_list

Next, copy this text file to the destination system over the network, via a USB key or whatever method you prefer. You may also want to copy over the /etc/apt/sources.list file from the base system, since the new system may not have all of the same repositories enabled (if the repositories aren't the same, the destination system may not be able to find some of the packages in the list).

Prepare the Destination System
Now you need to prepare the destination system. If both systems are running the same release of Ubuntu, this may be as simple as just copying the initial system's /etc/apt/sources.list on top of the one on the current system. Otherwise, if the systems are from different releases, you will want to compare the initial system's sources.list with the /etc/apt/sources.list file on your destination system and see if there are any extra third-party repositories or repository subcategories that need to be enabled. (Read "Modify the List of Package Repositories" [Hack #60] for more information on Ubuntu's repositories and how to edit sources.list.)

Once your sources.list file is settled, update your package list to make sure you get the latest version of the packages:
$ sudo apt-get update

Import the Package List
To import the package list, pipe the entire list to xargs, which then splits it into manageable chunks for the apt-get command:
$ cat package_list | xargs sudo apt-get install

If you are migrating to a different Ubuntu release, this will require a bit of trial and error, since you will likely get complaints about packages no longer existing. The simple fix for this is to edit the package list and remove the package from the list, save your changes, and then rerun the command. You will likely need to do this a number of times, but eventually you will have a list of valid packages. A more complicated but thorough fix would involve checking the latest list of packages for a potential update or replacement for the package that no longer exists and installing them one by one.

Once apt-get completes, you are finished. All of the files from the package list will have been imported into the new system. Now keep in mind that this doesn't mean that all of the settings have transferred over. To do that, you will likely need to copy settings from the /etc directory or possibly other directories, depending on the package.

Now my question is as follows:

It is written in the above paragraph as
Now keep in mind that this doesn't mean that all of the settings have transferred over. To do that, you will likely need to copy settings from the /etc directory or possibly other directories, depending on the package.

Now what exactly is the procedure for transferring the settings???

MS3FGX 09-28-2007 01:34 AM

The article referers to simply matching the installed packages from one installation to another, so naturally your custom configurations would not be included in that. It will be like a fresh installation (well, actually it will be a fresh installation.

To copy over any customizations you have made to your applications, you would copy the configuration files from your home directory. These will be hidden (prefixed with a ".", but can be copied and moved as any other file.

System-wide settings (like TCP/IP configuration, hostname, services, etc, etc) are stored under /etc. If you want to make the target machine identical to the new one, you would need to copy all of /etc, which should get 99% of your system configuration (there are a few applications that don't use /etc by default).

You can move these files anyway that is convienient for you, such as over the network of with a USB removable storage device. It will make it a lot more managable if you pack everything into a tar archive first, though. To make a tar archive from /etc for example, you would do the following:


tar cvf ~/etc_backup.tar /etc/

sridhar11 10-02-2007 05:31 AM

try this ubuntu clone tip

All times are GMT -5. The time now is 05:31 AM.