I've done rpm -qa > file
and now I want to copy the file to another server and run through it and install all these packages on the new server.
I did something like this: for pkg in
cat file; do yum -y install $pkg; done
and it works but takes too much time, do you know a shorter way to achieve this goal? I do not have an automatic configuration manager software installed.
If I knew how to run through the file and switch the newline with just a space I could run it simply by: yum install -y pkg1 pkg2 pkg3
but I don't know how to manipulate the data on the file so it will be displayed like that. (having spaces instead of newlines)
Add a comment
|
3 Answers
rpm -qa > file
contains version numbers. Its best to ignore it, in case the destination server has different architecture or the package has updated version. Retrieve the package name only with the following command:
$ rpm -qa --queryformat "%{NAME}\n"