Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Clone of this question: serverfault.com/questions/737/… –  Tobu Nov 20 '10 at 13:44
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
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 '10 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 '10 at 15:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.