In my CentOS machine (VirtualBox VM, altough I assume this shouldn't matter), I have a directory including an RPM file and all of its dependency RPM files.

I want to install the RPM along with all of its dependencies, but I want to install only using the files in this folder (not fetching the dependencies from remote repos).

I want to do this in order to make sure that I have all of the dependencies in this folder.

How can this be done?

  • or rpm -Uvh /path/to/folder/*.rpm – Jeff Schaller May 7 '16 at 18:20
  • @JeffSchaller Thanks, but this doesn't do what I want. – Aviv Cohn May 7 '16 at 21:14

You can do this using yum, by making a ".repo" repository file for your collection and running yum temporarily enabling this repository while disabling the other repositories. You might find this simplest by making a shell script to call yum while disabling the regular repositories. Use yum repolist to get the names to disable.

Something like

yum --disablerepo=foo "$@"

(you can list more than one --disablerepo option). Alternatively, you can disable all of the repositories and enable only those which you need, e.g.,

yum --disable-repo='*' --enable-repo=myrepo "$@"

Further reading:

Enables specific repositories by id or glob that have been disabled in the configuration file using the enabled=0 option. Configuration Option: enabled

Disables specific repositories by id or glob. Configuration Option: enabled

  • Thank you. I created a local repo like taught in the link you shared. However I think I found a simpler solution for using only the local repo, here: lists.centos.org/pipermail/centos/2006-April/021285.html I do yum --disablerepo=* --enablerepo=my_local_repo mypackage. Seems to work :) – Aviv Cohn May 7 '16 at 21:40
  • yes... it's been about a year since I did this last, and overlooked the simplified form. – Thomas Dickey May 7 '16 at 21:43
  • You're welcome to add the simple form to your answer, I'll mark it correct. – Aviv Cohn May 7 '16 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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