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.

If there are 2 versions of a given RPM available in a YUM repository, how can I instruct yum to install the version I want?

Looking through the Koji build service I notice that there are several versions.

    ss #1

share|improve this question

2 Answers 2

up vote 10 down vote accepted

To see what particular versions are available to you via yum you can use the --showduplicates switch.

$ yum --showduplicates list httpd | expand
Loaded plugins: fastestmirror, langpacks, refresh-packagekit
Loading mirror speeds from cached hostfile
 * fedora: mirror.steadfast.net
 * rpmfusion-free: csc.mcs.sdsmt.edu
 * rpmfusion-free-updates: csc.mcs.sdsmt.edu
 * rpmfusion-nonfree: csc.mcs.sdsmt.edu
 * rpmfusion-nonfree-updates: csc.mcs.sdsmt.edu
 * updates: mirror.steadfast.net
Available Packages
httpd.x86_64                        2.4.6-6.fc20                         fedora 
httpd.x86_64                        2.4.10-1.fc20                        updates

As far as installing a particular version? You can append the version info to the name of the package like so:

$ sudo yum install <package name>-<version info>

For example in this case if I wanted to install the older version, 2.4.6-6 I'd do the following:

$ sudo yum install httpd-2.4.6-6

You can also include the release info when specifying a package. In this case since I'm dealing with Fedora 20 (F20) the release info would be "fc20", and the architecture info too.

$ sudo yum install httpd-2.4.6-6.fc20
$ sudo yum install httpd-2.4.6-6.fc20.x86_64

repoquery

If you're ever unsure that you're constructing the arguments right you can consult with repoquery too.

$ repoquery --show-duplicates httpd-2.4*
httpd-0:2.4.6-6.fc20.x86_64
httpd-0:2.4.10-1.fc20.x86_64

downloading & installing

You can also use one of the following options to download a particular RPM from the web, and then use yum to install it.

$ yum --downloadonly <package>
-or-
$ yumdownloader <package>

And then install it like so:

$ sudo yum localinstall <path to rpm>

What if I want to download everything that package X requires?

$ yumdownloader --resolve <package>

Example

$ yumdownloader --resolve vim-X11
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
--> Running transaction check
---> Package vim-X11.x86_64 2:7.3.315-1.fc14 set to be reinstalled
--> Finished Dependency Resolution
vim-X11-7.3.315-1.fc14.x86_64.rpm                              | 1.1 MB     00:01

Notice it's doing a dependency check, and then downloading the missing pieces. See my answer that covers it in more details here: How to download a file from repo, and install it later w/o internet connection?.

References

share|improve this answer
    
I don't think it work for packages between the latest version located @updates and the initial version for the OS located @fedora. For example if you try to install httpd-2.4.8-1, yum would say package not available. –  Question Overflow Aug 23 at 8:51
    
@QuestionOverflow - not following. That version doesn't show as being available in the repo. –  slm Aug 23 at 12:38
    
Let me try again with a real example from my yum log. python-libs-2.7.5-12.fc20.x86_64 was once installed on my computer but has since been replaced. Assuming now I want to install this specific package, yumdownloader python-libs-2.7.5-12* would say No Match for argument python-libs-2.7.5-12* Nothing to download. What I am trying to say is that once a new package arrive, the old one would no longer be accessible from yum. You can only install the latest package or the initial version, but not versions in between. –  Question Overflow Aug 24 at 4:13
    
@QuestionOverflow - In that scenario I think you have to use yum downgrade ... if the package was already installed and you're attempting to go back to it later. In my Q I was attempting to show how one would hand select a particular version of a package that hadn't been installed yet. docs.fedoraproject.org/en-US/Fedora/14/html/… –  slm Aug 24 at 7:53
    
No, it doesn't work even when upgrading to a specific package. I have experimented this with a fresh installation just a few days ago. You can only yum update to the latest package and not any version you desire. –  Question Overflow Aug 24 at 8:05

Another option, you can download rpm file then instruct yum to do a localinstall:

yum localinstall /path/to/package.rpm
share|improve this answer
    
Is there a URL which contains most if not all versions of the rpm files? –  Question Overflow Aug 23 at 8:59
    
@QuestionOverflow: rpmfind.net –  cuonglm Aug 23 at 9:01
    
Thank you. This is useful! –  Question Overflow Aug 23 at 9:12
    
There's also yum --downloadonly <package>, followed by yum localinstall <path to package>, too. You can also use the utility yumdownloader <package> too. –  slm Aug 23 at 12:40

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.