How to install/update only a particular package in Fedora from a repo?

5,109

Solution 1

Assuming you have added the new repos by following the steps in the link you provided, then you can set them to be 'disabled' by default:

dnf config-manager --set-disabled fzug-free
dnf config-manager --set-disabled fzug-nonfree

Now, when you do any install/update, dnf won't install anything from these repos. In order to install simplescreenrecorder, simply do:

dnf install --enablerepo=fzug-* simplescreenrecorder

This will install only what's necessary for simplescreenrecorder and keep the fzug repos disabled for any other dnf command. No "fzug" packages will ever be installed unless you enable them or use the --enablerepo=fzug-* parameter again. If sometime later you want to update simplescreenrecorder to a newer version, along with its dependencies if required, then upgrade it explicitly:

dnf upgrade --enablerepo=fzug-* simplescreenrecorder

Solution 2

include=simplescreenrecorder*

in /etc/yum.repos.d/FZUG.repo (from official documentation) should give you what you want. But you need to append it to the appropriate enabled repos, so to the [fzug-free] and [fzug-nonfree], if you don't have enabled source.

Also you should run dnf update --refresh to make sure the cache is reloaded.

EDIT: This should work according to documentation, but it does not with current DNF 1.1.5 because of bug #1055910. The whole behaviour of include/exclude options is weird. I was thinking about some workaround, but so far without any success. Leaving here the informative post and maybe somebody will have brighter thoughts.

Share:
5,109

Related videos on Youtube

Ashesh
Author by

Ashesh

Updated on September 18, 2022

Comments

  • Ashesh
    Ashesh over 1 year

    Recently I added an unofficial 3rd party repo to my Fedora 23 install.

    Basically I am interested in the simplescreenrecorder package that this repo provides since it is not available in the official fedora repositories or RPMFusion.

    I would like to set the 3rd party repo in such a way that only that simplescreenrecorder package is installed/updated with their dependencies and nothing else.

    I have tried adding includepkgs=simplescreenrecorder* and includ=simplescreenrecorder* to the /etc/yum.repos.d/FZUG.repo file but dnf seems to ignore them.

    What can I do to make this work?

  • Ashesh
    Ashesh over 8 years
    I think you havn't understood my question. I know how to install simplescreenrecorder. But when I do operations like dnf update, I don't want newer version of the packages in the 3rd party repo that I already have installed from the official repos. I want to stick with the official repos as far as possible.
  • Jakuje
    Jakuje over 8 years
    sorry. I edited the answer. Include should work as described, but don't forget to refresh metadata.
  • Ashesh
    Ashesh over 8 years
    That's what I have been trying. I researched a bit more and found this bugzilla.redhat.com/show_bug.cgi?id=1055910. Still, it would be nice if someone could confirm this. Thanks for the help.
  • Jakuje
    Jakuje over 8 years
    Ok. You are right. I just tried myself and this part of DNF looks still more broken then useful. Commenting on the bug and filling your use case might help the developer prioritize things. From my POV your is quite reasonable and might have been accepted.
  • Ashesh
    Ashesh over 8 years
    This works but is cumbersome. Thanks.
  • forcefsck
    forcefsck over 8 years
    @Ashesh, it depends how often you think you'd need to run these commands. The install is done once and maybe you won't need the upgrade command that often if ever. If it does your job, don't get too obsessed with upgrades.
  • Ashesh
    Ashesh over 8 years
    I handle updates manually so I need to do this quite often. I have added this to my ~/.bashrc file to assist me alias dnfupnow='su -c "dnf -y update --refresh; dnf -y upgrade --enablerepo=fzug-*free simplescreenrecorder; dnf -y upgrade --enablerepo=fedora-HandBrake HandBrake"'