27

I am trying to locally install an rpm package without using the internet. I tried the following:

sudo rpm -u kernel-devel-4.2.7-200.fc22.x86_64.rpm

and I got:

error: kernel-devel-4.2.7-200.fc22.x86_64.rpm: hdr blob(2060952): BAD, read returned 0
error: kernel-devel-4.2.7-200.fc22.x86_64.rpm cannot be installed

I also tried:

sudo dnf --disablerepo='*' install kernel-devel-4.2.7-200.fc22.x86_64.rpm

and it still seems to be using the internet, so I can't figure out if it works or not since the internet connection is really slow.

Is there a way to fix this?

4
  • sudo dnf install /path/to/package.rpm
    – ILMostro_7
    Dec 13, 2015 at 23:28
  • @ILMostro_7 Thanks, but it's still using the internet.
    – kolonel
    Dec 13, 2015 at 23:36
  • 1
    @ILMostro_7 actually sorry, it works now. Thanks.
    – kolonel
    Dec 13, 2015 at 23:50
  • Sounds good. In that case, please accept the answer as the correct solution.
    – ILMostro_7
    Jul 30, 2020 at 11:56

2 Answers 2

46

sudo dnf install /path/to/package.rpm will act on the package in the given path.

7
  • 6
    When trying this on a LIVE cd, I have to add --disablerepo=*
    – Andy
    Mar 28, 2018 at 16:36
  • @Andy, I'm not sure if that's something that has changed with recent versions of dnf, but I don't see why you wouldn't be able to install the package locally by explicitly providing the full path to the rpm file as suggested in the answer.
    – ILMostro_7
    Mar 30, 2018 at 4:14
  • I found out that in the end, you are right. What was happening for me, is that I was trying to install 10 RPMs, but I was accidentally missing one dependency. I had never run a dnf command online, so my yum cache was empty. Without --disablerepo, all I got was an error message failing to update the "Updates" repo. So I had no idea what the error was, but with the --disablerepo, I got a nice clear message that I was missing an package.
    – Andy
    Apr 3, 2018 at 2:36
  • 2
    I'll answer my own comment, localinstall is a deprecated alias for install : dnf.readthedocs.io/en/latest/command_ref.html Oct 30, 2019 at 19:10
  • 1
    @ILMostro_7, in my case the system does not have access to the repositories over the network and the installation hangs when updating the metadata. So --disablerepo=* skips updating the metadata and starts installing the local package right away.
    – SergA
    Dec 13, 2022 at 12:28
1
sudo dnf localinstall kernel-devel-4.2.7-200.fc22.x86_64.rpm

This worked for me!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .