Useful Yum Commands: Installing by Path

25 May 2012

Every once in a while I find myself trying to install something, but not knowing what package contains it.

# yum install g++
Setting up Install Process
No package g++ available.
Error: Nothing to do

But if you’re using a modern version of yum (i.e. that of RHEL 6 or Fedora) then you can simply tell it to install the program you’re looking for.

# yum install /usr/bin/g++
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.4.6-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

4 Responses to “Useful Yum Commands: Installing by Path”


  1. If you just want to look and see what contains the file, you could always do:

    # yum whatprovides /usr/bin/g++

  2. Kevin Kofler Says:

    Or repoquery -f /usr/bin/g++, which looks for files specifically.

  3. doraemon Says:

    hi, i’m looking for similar functionality as dpkg (ie scanning paths for packages and then they became available via apt-get) in yum or rpm. so far i’m only creating local repo with createrepo, but as times goes by and my package collection gets bigger, it’s hard to maintain. i’m a fedora n00b, please enlighten me.


Comments are closed.