• Say you have an old crufty CentOS host that you cannot absolutely touch because it is workingtm (apart from the occasional apache-OOM, that is).
  • Say you are required to migrate this old system to a new hardware (perhaps to a VM), and, for the occasion, to a more recent CentOS version.

Fortunately with Linux, you have plenty of options!

One of them could be by manually cloning the old CentOS configuation to the new one (essentially by trying to replicate the existing setup on the new system).

But how to clone the installed programs list to the new one? It can be done!

On the Old CentOS host:

Launch (on the old system):

rpm -qa --queryformat “%{NAME}\n” > yum.packages.list

This command will export the list of the applications installed on the old CentOS without the architecture extension, version number, revision, etc. (ie: "gnome-utils-libs" vs "gnome-utils-libs-2.28.3-1.fc11.i586").

Much better, but the real advantage of the previous command is that it will create a list of packages compatible to yum (ie.: this packages list could be directly supplied to the yum command)!

On the New CentOS host.

This way you could:

yum -y install < yum-packages.list

And yum will simply fetch and install the latest versions of the packages specified on the list file directly from its repos. Please note that, before launching the previous command, I'd recommend you to at least check the repos (on both systems).

Now you can focus on the serious stuff: the /etc folder and the configuration files. Good luck!



Senior Professional Network and Computer Systems Engineer during work hours and father when home.

Andrea strives to deliver outstanding customer service and heaps of love towards his family.

In this Ad-sponsored space, Andrea shares his quest for "ultimate" IT knowledge, meticulously brought to you in an easy to read format.

Clone installed packages between different CentOS versions.
Rate this post

4 comments on “Clone installed packages between different CentOS versions.

  • In addition, keeping Wilbert's correction in mind as well, the above command for installing the packages on the new host is incorrect. The filename was not typed exactly as created on the old system.
    Correction below:

    yum -y install < yum.packages.list

    • In fact, the command didn't work for my on CentOS 6.5.

      The reason why this didn't work was for two reasons:
      1. because the command had the wrong double quotes that are pretty printed here.

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

      2. the yum install command didn't accept the file's contents properly. so I used cat instead with the following command:

      yum -y install $(cat yum.packages.list)

      There were some packages that didn't show up as available in the initial install process listing, but the dependencies resolving in the install process fixed it at the end.

Comments are closed.