semanage Command Not Found CentOS7/RHEL7
Lately, I was configuring Caching-Only DNS on CentOS7 / RHEL7, once i tried to configure SElinux context on /etc/named.conf using: semanage fcontext -a -t named_conf_t /etc/named.conf, it didn’t work.! and threw the following error: -bash: semanage: command not found. Let me show you how i fix this error “semanage Command Not Found CentOS7/RHEL7”
After a bit of googling, I figured out, to have “semanage” command on system, we need to install policycoreutils-python package by using yum command.
If you are not aware which package provides any particular command, you can use yum provides command to find out package name.
For example if we need to find out which package provides “semanage” command, you need to type the following command
yum provide semanage
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.coreix.net * extras: mirrors.coreix.net * updates: mirrors.coreix.net policycoreutils-python-2.5-17.1.el7.x86_64 : SELinux policy core python utilities Repo : base
Result showing policycoreutils-python-2.5-17.1.el7.x86_64 package needed in order to get “semanage”.
so, let us install policycoreutils-python-2.5-17.1.el7.x86_64 package using following command:
yum install policycoreutils-python-2.5-17.1.el7.x86_64 -y
Verifying : policycoreutils-2.5-11.el7_3.x86_64 13/15 Verifying : audit-libs-2.6.5-3.el7_3.1.x86_64 14/15 Verifying : libsemanage-2.5-5.1.el7_3.x86_64 15/15 Installed: policycoreutils-python.x86_64 0:2.5-17.1.el7 Dependency Installed: audit-libs-python.x86_64 0:2.7.6-3.el7 checkpolicy.x86_64 0:2.5-4.el7 libcgroup.x86_64 0:0.41-13.el7 libsemanage-python.x86_64 0:2.5-8.el7 python-IPy.noarch 0:0.75-6.el7 setools-libs.x86_64 0:3.3.8-1.1.el7 Dependency Updated: audit.x86_64 0:2.7.6-3.el7 audit-libs.x86_64 0:2.7.6-3.el7 libsemanage.x86_64 0:2.5-8.el7 policycoreutils.x86_64 0:2.5-17.1.el7 Complete!
That’s all, i was able to run “semanage” command after installing above command.
I am Hafiz Haider, co-founder of BroExperts.com. A Computer Geek and a certified Linux enthusiast (RHCE, RHCSA), who strongly believes in sharing knowledge.. You can reach me at firstname.lastname@example.org.