I recently had to provision a RedHat Enterprise Linux 6 system for a customer that owned a production system that I have provisioned four years ago. The new system requirement was to match the same package version as the old system (that they left un-updated since the deployment – fortunately for them it was an internal system!).
Here is what I did to deliver the system as per the customer’s request.
1. Install the OS using the same major and minor version as the source system (ex: v6.4). You can easily find out on the source system using the following command :
cat /etc/redhat-release
2. On the source system, issue the following command as root :
rpm -qa | sort > pkg.txt
3. Copy that file list (pkg.txt) on the new system – example :
scp pkg.txt root@192.168.1.11:
4. On the new system, execute the following command (this example assume that the “pkg.txt” file has been placed under “/root” home folder :
yum install $(cat /root/pkg.txt|xargs)
This will take a while to process. Using this method, I have seen sometime that some dependencies failed because specific packages versions were no longer available in the repo. In that case you will have to manually play with exclusion to make it work.