I am very new to using ubuntu servers and I have two of them. One has everything I need configured properly and working (it runs a nodes app that I developed), the other is a fresh, stronger server I just received. How would I go about copying/replicating the entire server from my first one to my second one? both are running versions 16.04

  • 1
    swap the hdds between the 2 machines. – Ipor Sircer Feb 19 '18 at 18:35
  • 1
    Use clonezilla to make an image of the good OS and clone it onto the new machine. – jc__ Feb 19 '18 at 19:31
  • 2
    I don't think this is a request for learning materials at all. It does show a lack of effort though and for that I will downvote. Are we abusing “Request for learning materials” as a reason to close? – jesse_b Feb 19 '18 at 23:39
  • 1
    @Ricky: What do you mean wrong question? -- As for lack of effort. You should have googled your question first, you will find several applications designed for doing what you need. Then you should have tried using one or many of them. Then if you ran into problems you should have asked a question about the specific problem you had. – jesse_b Feb 19 '18 at 23:48
  • 1
    I linked that meta question because people are trying to close your question as a "request for learning materials" and it is not that. As for the information it would have helped. Not a long winded diatribe, but if you have already tried several applications you should mention them and why they didn't work for you so that nobody else wastes their time suggesting them. – jesse_b Feb 19 '18 at 23:53

The are two things to consider: The installed packages and the configuration of those.

For the configuration, that's what configuration management systems are for. With just two servers it might look like overkill, but I would recommend it anyway, especially if you see a future with a third/fourth/... server. If you don't want a configuration management system, you'll basically have to copy the configuration manually.

For the installed packages: I don't know if ubuntu has some fancy tools for this, but ubuntu is based on Debian which does:

dpkg --get-selections >file
dpkg --set-selections <file
apt-get dselect-upgrade

Remember to read the documentation of any command before executing it, I would also recommend looking into the file.

  • Thank you your answer helped me understand better how to copy configuration of my old server to the new – Ricky Feb 19 '18 at 23:46
  • This is a 20th century answer, there are better tools nowadays. Use apt-clone instead, this preserves far more things. @Ricky – Gilles 'SO- stop being evil' Mar 3 '18 at 10:27

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