Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there any way to install packages through yum from a file?

Something like:

yum -f packages.txt

I couldn't find anything in the man pages.

packages.txt would contain something like:

bash
bc
binutils
bzip2
bzip2-libs
ca-certificates
cairo
share|improve this question
    
why rpm -ivh filename won't do it? –  Hubert Kario Jan 18 '12 at 22:07
    
@HubertKario, yum will resolve dependencies. –  cjc Jan 18 '12 at 22:25

2 Answers 2

up vote 6 down vote accepted
xargs yum -y install < filename
share|improve this answer

This works:

yum install `cat <filename> | tr '\n' ' '`

As should:

yum install `cat <filename>`

I added the pipe to tr as a sanity check, just in case the environment is wacky.

per a comment:

yum install $(cat <filename>)

will also work, rather than using the backticks.

share|improve this answer
    
Just tried the exact same thing - interestingly enough, it doesn't seem necessary to remove the line breaks (although, of course, it works with them removed) –  cyberx86 Jan 18 '12 at 17:33
    
@cyberx86 - I did the tr bit out of paranoia :) –  warren Jan 18 '12 at 17:34
    
The accepted practice nowadays is to wrap Bash shell commands with $( foo bar) instead of backticks. –  Magellan Jan 18 '12 at 20:43
    
@AdrianK - thanks for the suggestion. I've been using backticks for a really long time ... it'll take some getting used to :) –  warren Jan 18 '12 at 22:04

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.