GNU/Linux >> Tutoriels Linux >  >> Cent OS

Comment réparer l'erreur "commande semanage" introuvable dans CentOS

J'essaie de configurer un pgadmin4 avec des valeurs de contexte de sécurité correctes et par défaut à l'aide d'un setup-web.sh scénario. il a la commande semanage pour apporter des modifications à la politique SELinux pour autoriser l'accès à pgAdmin, mais j'ai soudainement rencontré l'erreur suivante.

[root@unixcop ~]# /usr/pgadmin4/bin/setup-web.sh
Setting up pgAdmin 4 in web mode on a Redhat based platform...
Creating configuration database...
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...
Configuring SELinux...
/usr/pgadmin4/bin/setup-web.sh: line 87: semanage: command not found
/usr/pgadmin4/bin/setup-web.sh: line 89: semanage: command not found
The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4

L'erreur était que semanage commande introuvable.

gestion de la sécurité

Le semanage la commande est un SELinux (SécuritéLinux amélioré ) outil de gestion utilisé pour configurer des éléments spécifiques sans effectuer d'ajustements ou de réassemblage à partir des sources de stratégie. Semanage consiste à mapper le nom d'utilisateur Linux aux identités des utilisateurs SELinux et inclut également le mappage du contexte de sécurité pour de nombreux types d'objets tels que l'interface, le port réseau, etc.

Vous devez utiliser yum fournit , cette option permet de connaître le package qui fournit le fichier interrogé appelé /usr/sbin/semanage .

Nous expliquerons comment installer les packages nécessaires pour obtenir la commande semanage en utilisant la commande yum.

[root@unixcop ~]# yum provides /usr/sbin/semanage
Last metadata expiration check: 0:20:11 ago on Mon Aug  9 10:46:23 2021.
policycoreutils-python-utils-2.9-14.el8.noarch : SELinux policy core python utilities
Repo        : baseos
Matched from:
Filename    : /usr/sbin/semanage

Vous pouvez voir que nous devons installer policycoreutils-python-utils-2.9-14.el8.noarch package pour utiliser le semanage commande.

[root@unixcop ~]# yum install policycoreutils-python-utils

Last metadata expiration check: 0:20:24 ago on Mon Aug  9 10:46:23 2021.
Dependencies resolved.
======================================================================================================================================================
 Package                                       Architecture            Version                                          Repository               Size
======================================================================================================================================================
Installing:
 policycoreutils-python-utils                  noarch                  2.9-14.el8                                       baseos                  252 k
Installing dependencies:
 checkpolicy                                   x86_64                  2.9-1.el8                                        baseos                  348 k
 python3-audit                                 x86_64                  3.0-0.17.20191104git1c2f876.el8                  baseos                   86 k
 python3-libsemanage                           x86_64                  2.9-6.el8                                        baseos                  127 k
 python3-policycoreutils                       noarch                  2.9-14.el8                                       baseos                  2.2 M
 python3-setools                               x86_64                  4.3.0-2.el8                                      baseos                  626 k

Transaction Summary
======================================================================================================================================================
Install  6 Packages

Total download size: 3.6 M
Installed size: 11 M
Is this ok [y/N]: Operation aborted.
[root@unixcop ~]# yum install policycoreutils-python-utils
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:20:29 ago on Mon Aug  9 10:46:23 2021.
Dependencies resolved.
======================================================================================================================================================
 Package                                       Architecture            Version                                          Repository               Size
======================================================================================================================================================
Installing:
 policycoreutils-python-utils                  noarch                  2.9-14.el8                                       baseos                  252 k
Installing dependencies:
 checkpolicy                                   x86_64                  2.9-1.el8                                        baseos                  348 k
 python3-audit                                 x86_64                  3.0-0.17.20191104git1c2f876.el8                  baseos                   86 k
 python3-libsemanage                           x86_64                  2.9-6.el8                                        baseos                  127 k
 python3-policycoreutils                       noarch                  2.9-14.el8                                       baseos                  2.2 M
 python3-setools                               x86_64                  4.3.0-2.el8                                      baseos                  626 k

Transaction Summary
======================================================================================================================================================
Install  6 Packages

Total download size: 3.6 M
Installed size: 11 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64.rpm                                                        66 kB/s |  86 kB     00:01    
(2/6): python3-libsemanage-2.9-6.el8.x86_64.rpm                                                                       113 kB/s | 127 kB     00:01    
(3/6): policycoreutils-python-utils-2.9-14.el8.noarch.rpm                                                              98 kB/s | 252 kB     00:02    
(4/6): checkpolicy-2.9-1.el8.x86_64.rpm                                                                                94 kB/s | 348 kB     00:03    
(5/6): python3-setools-4.3.0-2.el8.x86_64.rpm                                                                         172 kB/s | 626 kB     00:03    
(6/6): python3-policycoreutils-2.9-14.el8.noarch.rpm                                                                  223 kB/s | 2.2 MB     00:10    
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 279 kB/s | 3.6 MB     00:13     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Installing       : python3-setools-4.3.0-2.el8.x86_64                                                                                           1/6 
  Installing       : python3-libsemanage-2.9-6.el8.x86_64                                                                                         2/6 
  Installing       : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                                                         3/6 
  Installing       : checkpolicy-2.9-1.el8.x86_64                                                                                                 4/6 
  Installing       : python3-policycoreutils-2.9-14.el8.noarch                                                                                    5/6 
  Installing       : policycoreutils-python-utils-2.9-14.el8.noarch                                                                               6/6 
  Running scriptlet: policycoreutils-python-utils-2.9-14.el8.noarch                                                                               6/6 
  Verifying        : checkpolicy-2.9-1.el8.x86_64                                                                                                 1/6 
  Verifying        : policycoreutils-python-utils-2.9-14.el8.noarch                                                                               2/6 
  Verifying        : python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64                                                                         3/6 
  Verifying        : python3-libsemanage-2.9-6.el8.x86_64                                                                                         4/6 
  Verifying        : python3-policycoreutils-2.9-14.el8.noarch                                                                                    5/6 
  Verifying        : python3-setools-4.3.0-2.el8.x86_64                                                                                           6/6 

Installed:
  checkpolicy-2.9-1.el8.x86_64             policycoreutils-python-utils-2.9-14.el8.noarch     python3-audit-3.0-0.17.20191104git1c2f876.el8.x86_64    
  python3-libsemanage-2.9-6.el8.x86_64     python3-policycoreutils-2.9-14.el8.noarch          python3-setools-4.3.0-2.el8.x86_64                      

Complete!

Essayez d'exécuter la commande semanage encore une fois, cela fonctionnera comme par magie.

Vous pouvez également utiliser les commandes suivantes pour obtenir la page de manuel sur la commande semanage options et utilisation.

# man semanage
# semanage --help

Je peux également vérifier cela en exécutant mon setup-web.sh script à nouveau.

[root@unixcop ~]# /usr/pgadmin4/bin/setup-web.sh
Setting up pgAdmin 4 in web mode on a Redhat based platform...
Creating configuration database...
pgAdmin 4 - Application Initialisation
======================================

Creating storage and log directories...
Configuring SELinux...
The Apache web server is running and must be restarted for the pgAdmin 4 installation to complete. Continue (y/n)? y
Apache successfully restarted. You can now start using pgAdmin 4 in web mode at http://127.0.0.1/pgadmin4

Il a été exécuté correctement.


Cent OS
  1. Commande semanage introuvable dans CentOS 8 / RHEL 8

  2. Comment corriger une erreur de commande introuvable sous Linux

  3. Erreur :Commande de configuration introuvable dans CentOS VPS [Résolu]

  4. CentOS - erreur de commande semanage introuvable - Le correctif est là!

  5. Comment réparer la commande Sudo introuvable dans Debian 10

5 Solutions - Comment réparer l'erreur "Commande Zsh introuvable" sous Linux ou macOS

Comment corriger l'erreur "Yum command not found" sous Linux [Mise à jour 2022]

Rendre la commande introuvable ? Voici comment y remédier

Comment réparer la commande Ifconfig introuvable sur CentOS 7

Comment réparer la commande Ifconfig introuvable sur Ubuntu 20.04 LTS

Comment réparer :la commande curl n'a pas trouvé d'erreur