Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Ubuntu This forum is for the discussion of Ubuntu Linux.


  Search this Thread
Old 09-27-2007, 01:32 AM   #1
Registered: Dec 2004
Location: India
Distribution: ubuntu 10.04 , centos 5.5 , Debian lenny, Freenas
Posts: 324

Rep: Reputation: 36
Question 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???
Old 09-28-2007, 01:34 AM   #2
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
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/
Old 10-02-2007, 05:31 AM   #3
Registered: Dec 2002
Location: us
Posts: 108
Blog Entries: 360

Rep: Reputation: 15
try this ubuntu clone tip


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone an audio CD ... TheHighwayman Linux - Software 2 06-13-2007 12:31 PM
Can I clone myself? fannymites SUSE / openSUSE 3 03-02-2006 03:06 AM
clone() documentation scorpio2002 Programming 7 12-25-2005 02:26 PM
how to use clone() icoming Programming 1 02-03-2005 11:19 AM
how to clone an installation cestor Linux - General 3 03-18-2002 09:24 PM > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration