1

I have a production server running Ubuntu. I would like to setup similar configuration installed on my local machine for testing purposes. I'd like to have same packages installed and mimic same configuration.

Since bandwidth is a constraint the traditional disk cloning methods won't be effective. Having same packages installed and same configuration (users, passwords, environment variables) would be wonderful; i'll tweak rest of the things manually and rsync the user data.

Is there a good solution to my requirements?

1

1 Answer 1

3

I do this on CentOS systems all the time, and the basic idea should probably work well with Ubuntu. The basic process is:

  • Get a list of packages installed on the remote system
  • Pass that list to the package installer on your local system

This web page appears to address the question for Ubuntu:

Basically:

ssh othersystem dpkg --get-selections | dpkg --set-selections
dselect

Caveta: completely untested on my part. If I had to figure out how to do this on my own, I would have probably generated a package list using some variant of dpkg-query, and then passed that to apt-get install, but this seems a lot cleaner.

It's also possible that, having installed the correct set of packages, you could use something like rsync to copy over any changes. In theory, since the installed packages are the same this will dramatically reduce the bandwidth necessary to complete the clone. In practice this may not work as gracefully as one would hope, so it may make more sense just to implement the specific configuration by hand.

2
  • Fantastic. Is it also possible to clone user settings? e.g. create the same users, set their passwords and copy other settings?
    – sharjeel
    Nov 20, 2010 at 15:32
  • Well, sure, but now quite as cleanly. This would typically mean copying over /etc/{passwd,group,shadow,gshadow} and using something like rsync to copy over all home directories.
    – larsks
    Nov 20, 2010 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .