After installing the RHEL 6 and CentOS6 with minimal installation, we were configuring the rsyslog server. While configuring the rsyslog, without verifying we hit the semanage command. And result was with error – bash: semanage: command not found .
The method is applicable to Red Hat based operating system like RHEL 6 and CentOS 6.
What is semanage
The semanage is a SELinux Policy Management tool.With the help of semanage,we can configure the certain elements of SELinux policy without requiring modification to or recompilation from policy sources.
How to install semanage command in Red Hat based operating system
To install semanage ,run the below given command
yum install policycoreutils-python
[root@localhost ~]# yum install policycoreutils-python
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
* base: centosmirror.go4hosting.in
* extras: centosmirror.go4hosting.in
* updates: centosmirror.go4hosting.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package policycoreutils-python.x86_64 0:2.0.83-19.39.el6 will be installed
--> Processing Dependency: libsemanage-python >= 2.0.43-4 for package: policycoreutils-python-2.0.83-19.39.el6.x86_64
--> Processing Dependency: audit-libs-python >= 1.4.2-1 for package: policycoreutils-python-2.0.83-19.39.el6.x86_64
--> Processing Dependency: setools-libs-python for package: policycoreutils-python-2.0.83-19.39.el6.x86_64
--> Processing Dependency: libselinux-python for package: policycoreutils-python-2.0.83-19.39.el6.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.0.83-19.39.el6.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.2-2.el6 will be installed
---> Package libcgroup.x86_64 0:0.40.rc1-5.el6_5.1 will be installed
---> Package libselinux-python.x86_64 0:2.0.94-5.3.el6_4.1 will be installed
---> Package libsemanage-python.x86_64 0:2.0.43-4.2.el6 will be installed
---> Package setools-libs-python.x86_64 0:3.3.7-4.el6 will be installed
--> Processing Dependency: setools-libs = 3.3.7-4.el6 for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libsefs.so.4(VERS_4.0)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libseaudit.so.4(VERS_4.2)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libseaudit.so.4(VERS_4.1)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.3)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libpoldiff.so.1(VERS_1.3)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libpoldiff.so.1(VERS_1.2)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.1)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libsefs.so.4()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libseaudit.so.4()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libpoldiff.so.1()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: setools-libs-python-3.3.7-4.el6.x86_64
--> Running transaction check
---> Package setools-libs.x86_64 0:3.3.7-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================
Package Arch Version Repository Size
=====================================================================================================
Installing:
policycoreutils-python x86_64 2.0.83-19.39.el6 base 343 k
Installing for dependencies:
audit-libs-python x86_64 2.2-2.el6 base 59 k
libcgroup x86_64 0.40.rc1-5.el6_5.1 updates 125 k
libselinux-python x86_64 2.0.94-5.3.el6_4.1 base 202 k
libsemanage-python x86_64 2.0.43-4.2.el6 base 81 k
setools-libs x86_64 3.3.7-4.el6 base 400 k
setools-libs-python x86_64 3.3.7-4.el6 base 222 k
Transaction Summary
=====================================================================================================
Install 7 Package(s)
Total download size: 1.4 M
Installed size: 5.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): audit-libs-python-2.2-2.el6.x86_64.rpm | 59 kB 00:01
(2/7): libcgroup-0.40.rc1-5.el6_5.1.x86_64.rpm | 125 kB 00:02
(3/7): libselinux-python-2.0.94-5.3.el6_4.1.x86_64.rpm | 202 kB 00:04
(4/7): libsemanage-python-2.0.43-4.2.el6.x86_64.rpm | 81 kB 00:01
(5/7): policycoreutils-python-2.0.83-19.39.el6.x86_64.rpm | 343 kB 00:05
(6/7): setools-libs-3.3.7-4.el6.x86_64.rpm | 400 kB 00:10
(7/7): setools-libs-python-3.3.7-4.el6.x86_64.rpm | 222 kB 00:04
-----------------------------------------------------------------------------------------------------
Total 38 kB/s | 1.4 MB 00:37
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libselinux-python-2.0.94-5.3.el6_4.1.x86_64 1/7
Installing : setools-libs-3.3.7-4.el6.x86_64 2/7
Installing : setools-libs-python-3.3.7-4.el6.x86_64 3/7
Installing : libsemanage-python-2.0.43-4.2.el6.x86_64 4/7
Installing : libcgroup-0.40.rc1-5.el6_5.1.x86_64 5/7
Installing : audit-libs-python-2.2-2.el6.x86_64 6/7
Installing : policycoreutils-python-2.0.83-19.39.el6.x86_64 7/7
Verifying : audit-libs-python-2.2-2.el6.x86_64 1/7
Verifying : setools-libs-python-3.3.7-4.el6.x86_64 2/7
Verifying : libcgroup-0.40.rc1-5.el6_5.1.x86_64 3/7
Verifying : libsemanage-python-2.0.43-4.2.el6.x86_64 4/7
Verifying : policycoreutils-python-2.0.83-19.39.el6.x86_64 5/7
Verifying : setools-libs-3.3.7-4.el6.x86_64 6/7
Verifying : libselinux-python-2.0.94-5.3.el6_4.1.x86_64 7/7
Installed:
policycoreutils-python.x86_64 0:2.0.83-19.39.el6
Dependency Installed:
audit-libs-python.x86_64 0:2.2-2.el6 libcgroup.x86_64 0:0.40.rc1-5.el6_5.1
libselinux-python.x86_64 0:2.0.94-5.3.el6_4.1 libsemanage-python.x86_64 0:2.0.43-4.2.el6
setools-libs.x86_64 0:3.3.7-4.el6 setools-libs-python.x86_64 0:3.3.7-4.el6
Complete!
[root@localhost ~]#
Note: After installation, check the absolute path of semanage command.
Use the below given command
which semanage
Specimen :
[root@localhost ~]# which semanage /usr/sbin/semanage [root@localhost ~]#
Alternatively, you can also use the whereis
command
whereis semanage
Specimen :
[root@localhost ~]# whereis semanage semanage: /usr/sbin/semanage /usr/share/man/man8/semanage.8.gz [root@localhost ~]#
To know more about semanage. Read the man page of semanage
man semanage
Thanks. Its Helped a lot.
Thanks! Definitely helped!
You are welcome Sam!
Regards
Sharad