Sysadmins: What's the best way to clone a Linux system onto different hardware?

We have a web server that’s running CentOS 5 on bare-metal x86, and an old Mac Pro with an Intel processor sitting around locally. I’d like to clone the web server onto the Mac so it can be used as a test environment, but I’d like to keep the software as close as possible – especially the Apache/MySQL/PHP stack currently serving the website. Keeping the Linux would be best, but optional.

Since they’re both *NIX systems, is there any best built-in or popular tool to do this with?

Virtualizing the server into an image on the Mac would probably be ok too, but I’m still not sure of the best way to do that.

Advice appreciated :slight_smile:

Here is ONE solution:

You need an imaging utility that will convert your baremetal Linux into an image format that can be used by a hypervisor.

VMware have a free one

vCenter Converter:

Once you have the image file, you need to install a hypervisor on your Mac.

Either pay for VMware Fusion or use Oracle Virtualbox hypervisor for MAC and import your image file to create a new Virtual Machine.

rpm -qa to get a list of installed rpms on the source server

Install Centos 5 on your new system.
rpm -qa
diff the two package lists
yum install the missing rpms
(you might need to find and add some additional repositories like rpmforge)

That is a better, more long term solution because you can effectively document your image so it reproducible.

I would go further and create a docker image from centos based image. If you build it the image from a dockerfile, that records each step of the build very clearly. That would create a Linux container that you can run easily on almost any Linux hosting environment, including popular cloud services. It also allows you to put the image build dockerfile alongside your software development under the same version control.

However…that is a more work, for a longer term solution.

So there you go, a quick and dirty fix or a devops project that makes it all future-proof and portable.