0

I just did a fresh install of centos and spent ages adding all my standard libraries. Is there a way I can easily take a copy of this build and deploy to another new server?

DD.
  • 3,024
  • 10
  • 34
  • 50

2 Answers2

1

You can use any disk cloning tool like clonezilla. It supports many file systems including ext3 and ext4 (the most common in Linux environment).

Khaled
  • 35,688
  • 8
  • 69
  • 98
1

from the machine you want to copy to (boot from a live disk or network boot, format the hdds, and mount them somewhere. cd to that location (root of the hdd to be copied)) then run the following (copies everything perfectly over and securely)

ssh perfectlymademachine find -xdev / /boot \| cpio -o -H crc \| gzip -c | gzip -d | cpio -id --no-absolute-filenames

This will take quite a while (depending on network speeds). Now all that is left is installing your bootloader (if you're using grub, simply grub-install /dev/yourhdd_andPartition

reboot (and if you installed your bootloader correctly), everything should boot up and be exactly the same as your previous machine.

EDIT: Breakdown of that command:

ssh perfectlymademachine - ssh to machine (sets up secure transfer)

find -xdev / /boot - finds all the files in / and /boot and stays on their device (doesn't stray into network mounts). If you need to add /home (ie on a separate partition) then do so.

cpio -o -H crc \| gzip -c - streams the files and compresses them on the remote machine

gzip -c | cpio -id --no-absolute-filenames - uncompresses and writes stream to actual fiels on disk

NOTE: find -xdev / /boot \| cpio -o -H crc \| gzip -c is run on the remote machine, while the rest is run on the local machine.