We will try to install RPM packages from a file containing a list. The following command generates a list of installed RPM packages:
The same command but output the list into a file:
rpm -qa > rpms.txt
Now we can install the list of RPM packages based on the contents of the file “rpm.list”:
yum install `cat rpms.txt | sed 's/-[0-9]/*/' | cut -d"*" -f1`
The above command will use “yum” to install all packages as listed in the “rpms.txt” file.