Tuesday 4 January 2022

How to resolve -bash: semanage: command not found on CentOS 8



Semanage command: It is a command-line utility and provide ability to manage SELinux contexts. Its needs to separate installation by default this package is not available in CentOS 8 minimal.
 
This article describes How to resolve -bash: semanage: command not found on CentOS 8 System. 
 
[root@linuxcnf ~]# semanage -h
-bash: semanage: command not found
[root@linuxcnf ~]#
 
As per the above output, the package is not installed on the system which provides semanage command. Follow the below steps to resolve:
 
Step 1. Installing package: Run the following command to install semanage related packages:
 
[root@linuxcnf ~]# dnf install policycoreutils-python-utils –y
……………………..
Installed:
  checkpolicy-2.9-1.el8.x86_64                   policycoreutils-python-utils-2.9-16.el8.noarch           python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64
  python3-libsemanage-2.9-6.el8.x86_64           python3-policycoreutils-2.9-16.el8.noarch                python3-setools-4.3.0-2.el8.x86_64
 
Complete!
[root@linuxcnf ~]#
 
Step 2. Verification: Run the following command to validate/verify the installation.
 
[root@linuxcnf ~]# semanage -h
usage: semanage [-h]
……………………..
    boolean             Manage booleans to selectively enable functionality
    permissive          Manage process type enforcement mode
    dontaudit           Disable/Enable dontaudit rules in policy
 
optional arguments:
  -h, --help            show this help message and exit
[root@linuxcnf ~]#
 
Done!!! Now the command “semanage” is available on CentOS 8 system.

No comments:

Post a Comment