RedHat Server Duplication

Posted on Monday February 12th, 2018

There comes a time when it's necessary to duplicate a server - RedHat/CentOS in this instance.

The first point of call is to get a list of packages installed on the system being duplicated. For a raw listing of the packages placed in a file called packages.txt you can issue:

rpm -qa > packages.txt

but it is also possible to just get the names of the packages as follows:

rpm -qa --queryformat "%{NAME}\n" > packages.txt

To replicate the server, simply copy packages.txt to the target system and then issue the following command on the target system:

xargs yum -y install < packages.txt

Credit where credit is due:
http://www.pwrusr.com/system-administration/clone-installed-packages-between-different-centos-versions
https://serverfault.com/questions/532247/centos-how-to-install-all-packages-of-one-server-on-another