作为一个例子,我正在寻找一个mod_files.sh文件,该文件可能会随php-devel包而来。我猜yum会用php-devel x86_64 5.1.6-23.2安装mod_files.sh文件。El5_3包,但文件似乎没有安装在我的文件系统。
如何找出哪个包安装了特定的文件?我正在寻找我不一定已经在本地下载的包,其中可能包括我正在寻找的文件。
我用的是CentOS 5。
作为一个例子,我正在寻找一个mod_files.sh文件,该文件可能会随php-devel包而来。我猜yum会用php-devel x86_64 5.1.6-23.2安装mod_files.sh文件。El5_3包,但文件似乎没有安装在我的文件系统。
如何找出哪个包安装了特定的文件?我正在寻找我不一定已经在本地下载的包,其中可能包括我正在寻找的文件。
我用的是CentOS 5。
当前回答
这是一个老问题,但目前的答案是不正确的:)
使用yum what所提供的文件的绝对路径(可以是通配符)。例如:
yum whatprovides '*bin/grep'
返回
grep-2.5.1-55.el5.x86_64 : The GNU versions of grep pattern matching utilities.
Repo : base
Matched from:
Filename : /bin/grep
您可能更喜欢yum-utils包中提供的repoquery工具的输出和速度。
sudo yum install yum-utils
repoquery --whatprovides '*bin/grep'
grep-0:2.5.1-55.el5.x86_64
grep-0:2.5.1-55.el5.x86_64
Repoquery可以执行其他查询,如列出包内容、依赖项、反向依赖项等。
其他回答
最普遍的答案是不完整的:
由于这种搜索通常只会对已安装包中的文件执行,yum whatproviders通过禁用所有外部repo(隐式的“已安装”repo不能禁用)来实现极快的速度。
yum --disablerepo=* whatprovides <file>
要知道包拥有(或提供)一个已经安装的文件:
rpm -qf myfilename
您访问http://www.rpmfind.net并搜索该文件。
您将得到许多不同发行版和版本的结果,但很可能也会弹出Fedora和/或CentOS,并且您将知道要与yum一起安装的软件包名称
你可以在这里做同样的事情,但是用你的包。在我的例子中,它是lsb_release
执行命令:yum whatproviders lb_release
回应:
redhat-lsb-core-4.1-24.el7.i686 : LSB Core module support
Repo : rhel-7-server-rpms
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-24.el7.x86_64 : LSB Core module support
Repo : rhel-7-server-rpms
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-27.el7.i686 : LSB Core module support
Repo : rhel-7-server-rpms
Matched from:
Filename : /usr/bin/lsb_release
redhat-lsb-core-4.1-27.el7.x86_64 : LSB Core module support
Repo : rhel-7-server-rpms
Matched from:
Filename : /usr/bin/lsb_release`
执行命令install: yum install redhat-lsb-core
包装名称应该没有数字和系统类型,以便包装商可以选择最适合他的。
这是一个老问题,但目前的答案是不正确的:)
使用yum what所提供的文件的绝对路径(可以是通配符)。例如:
yum whatprovides '*bin/grep'
返回
grep-2.5.1-55.el5.x86_64 : The GNU versions of grep pattern matching utilities.
Repo : base
Matched from:
Filename : /bin/grep
您可能更喜欢yum-utils包中提供的repoquery工具的输出和速度。
sudo yum install yum-utils
repoquery --whatprovides '*bin/grep'
grep-0:2.5.1-55.el5.x86_64
grep-0:2.5.1-55.el5.x86_64
Repoquery可以执行其他查询,如列出包内容、依赖项、反向依赖项等。