How do I find which rpm package supplies a file I'm looking for?

后端 未结 7 1018
攒了一身酷
攒了一身酷 2020-12-04 05:11

As an example, I am looking for a mod_files.sh file which presumably would come with the php-devel package. I guessed that yum would i

7条回答
  •  醉梦人生
    2020-12-04 05:53

    Well finding the package when you are connected to internet (repository) is easy however when you only have access to RPM packages inside Redhat or Centos DVD (this happens frequently to me when I have to recover a server and I need an application) I recommend using the commands below which is completely independent of internet and repositories. (supposably you have lots of uninstalled packages in a DVD). Let's say you have mounted Package folder in ~/cent_os_dvd and you are looking for a package that provides "semanage" then you can run:

    for file in `find ~/cent_os_dvd/ -iname '*.rpm'`;  do rpm -qlp $file |grep '.*bin/semanage';  if [ $? -eq 0 ]; then echo "is in";echo $file  ; fi;  done
    

提交回复
热议问题