yum – install package that contains a specific file

Install_package_that_contains-2When I first worked with SELinux I was surprised that the management program was not installed together with it.

Once I found out that the program to manage the SELinux rules is called “semanage”, I tried to find a package of the same name in the yum repositories, but I could not find it. So I had to find a way to find which package provided the file I needed, and I was happy to find that that yum provides an easy way to find a file that is provided within a package:

$ yum provides */semanage

With thiscommand we search for packages that contain a file called “semanage” in whatever path. That way we get a list of packages and the lines that match the file we are looking for. In my case the result looks like this:

 libsemanage-devel-2.0.43-4.2.el6.x86_64 : Header files and libraries used to build policy manipulation tools
 Repo        : base
 Matched from:
 Filename    : /usr/include/semanage

 policycoreutils-python-2.0.83-19.30.el6.x86_64 : SELinux policy core python utilities
 Repo        : installed
 Matched from:
 Filename    : /usr/sbin/semanage

As I am not looking for an include file but for an executable, the package with semanage in the path /usr/sbin/ seems to be the one I am looking for, and as I have now the name of the package I can easily install it using the following command:

$ yum install policycoreutils-python

The version number can safely be skipped when installing the package.



Read more of my posts on my blog at https://blog.tinned-software.net/.

This entry was posted in Linux Administration, Security and tagged , , , . Bookmark the permalink.