Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to have server b to have exactly the same setup as server a.

My plan is to have a list of all installed things on server a and install it by using the list on server b something like :

yum -y install $(cat installed.txt)

In server a, should I rather use:

rpm -qa > installed.txt

or:

yum list installed > installed.txt  

? The lists seem to be different and I have no idea why.

yum list installed has 930 lines while rpm -qa has 895 lines, what might be the difference ?

share|improve this question
    
Have you diffed the outputs (possible after sorting)? –  Anthon Jul 23 at 17:01
    
I don't have an idea on why there is a difference between yum and rpm output. May be you should try Anthon's suggestion and let us know what is the output. Also, for me both the commands list the same number of lines and as per your plan, I would go with rpm list since it has the list that can be used in your server b's yum command. –  Ramesh Jul 23 at 17:13

3 Answers 3

yum list installed has 930 lines while rpm -qa has 895 lines, what might be the difference ?

This is likely just formatting differences. yum list will do a bunch of clever wrapping to your terminal size.

What you probably want to do is use:

# Run this on the master server
yum-debug-dump

# Run this on the new server, with the input from the above.
yum-debug-restore
share|improve this answer
    
thanks for reply, after installing yum-utils on the new server and run "yum-debug-restore master_out.gz" it says for every package that its not available, am i missing something ? –  john Smith Jul 25 at 13:03
    
If they aren't identical servers (Eg. different arch, or the new one has older packages) you can use the --ignore-arch and/or --install-latest options on restore. –  James Antill Aug 3 at 21:13

I'm not entirely sure why the lists are different, but I do know that 'rpm -qa > installed.txt' is the correct way to find all of the installed packages. It will look for yum installed as well as rpm installed.

In addition, the format of 'rpm -qa' output will work better with the yum install command that you are wanting to execute.

share|improve this answer

yum list installed gives me the output as below.

pam_krb5.i386                        2.2.14-22.el5                     installed

Now, rpm -qa has the below to say.

pam_krb5-2.2.14-22.el5

Both the commands give me the same number of lines as output. I would go with rpm -qa list.

Also, from this answer, I see the below piece of information.

there is the program, "rpm", which manipulates specifically the packages it is asked to manipulate, and there is "yum", which is a more intelligent management system that can find dependencies and download .rpm files even if they're not in the system.

So the difference might be yum resolves the dependencies but rpm has installed all the dependencies and so it provides a more complete list.

I see the actual difference between yum and rpm as below.

The most prominent problem with rpm is a state commonly referred to by most people as dependency hell. This problem occurs with packages that depend on a lot of other packages, some of those packages also depend on a lot of other packages. It is common knowledge that you must install all dependencies for the program to work correctly. rpm is unable to automatically do this for you. It can only check whether all the required packages are installed prior to installing the needed package. Manually tracking and installing each dependency is a major chore for most people who only want to install a single package initially.

yum is capable of tracking the dependencies of a package and installing them prior to installing the package that the user wanted to install. This simplifies the whole process as you need only know the name of the package that you want to install and not worry whether the required packages have been installed or not. Packages that can’t be found on the system are searched for in the repositories that are available to the system.

References

http://www.differencebetween.net/technology/difference-between-yum-and-rpm/

share|improve this answer
    
thanks for reply, for me yum list installed has 940 lines while rpm -qa has 895 lines , any idea what might be the difference ? –  john Smith Jul 23 at 16:54
    
@johnSmith, Yum handles dependencies and fetches packages to fill them. Yum runs effectively the same command as rpm but also includes all the packages needed to match dependencies. –  Ramesh Jul 23 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.