
Saat saya sedang menyusun artikel tentang instalasi MongoDB di CentOS , saya harus menjalankan perintah semanage untuk membuat perubahan di SELinux kebijakan untuk mengizinkan kami mengakses MongoDB pada port 27017.
semanage port -a -t mongod_port_t -p tcp 27017
Yang mengejutkan saya, saya mendapatkan kesalahan.
-bash: semanage: command not found
semanage digunakan untuk mengonfigurasi bagian tertentu dari kebijakan SELinux tanpa memerlukan modifikasi atau kompilasi ulang dari sumber kebijakan.
Posting kecil ini akan membantu Anda menginstal paket yang diperlukan untuk mendapatkan perintah semanage. Mari kita lihat paket mana yang memberi kita perintah ifconfig menggunakan YUM perintah.
yum whatprovides semanage
ATAU
yum provides *bin/semanage
Keluaran:
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iitm.ac.in * extras: ftp.iitm.ac.in * updates: ftp.iitm.ac.in base/7/x86_64/filelists_db | 6.7 MB 00:00:01 extras/7/x86_64/filelists_db | 528 kB 00:00:00 nginx/x86_64/filelists_db | 39 kB 00:00:00 updates/7/x86_64/filelists_db | 3.1 MB 00:00:00 policycoreutils-python-2.5-17.1.el7.x86_64 : SELinux policy core python utilities Repo : base Matched from: Filename : /usr/sbin/semanage

Dari output perintah di atas, Anda dapat melihat bahwa paket policycoreutils-python memberi Anda perintah semanage . Sekarang, instal paket policycoreutils-python menggunakan YUM perintah.
yum -y install policycoreutils-python
Keluaran:
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iitm.ac.in * extras: ftp.iitm.ac.in * updates: ftp.iitm.ac.in Resolving Dependencies --> Running transaction check ---> Package policycoreutils-python.x86_64 0:2.5-17.1.el7 will be installed --> Processing Dependency: setools-libs >= 3.3.8-1 for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libsemanage-python >= 2.5-5 for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-17.1.el7.x86_64 --> Running transaction check ---> Package audit-libs-python.x86_64 0:2.7.6-3.el7 will be installed ---> Package checkpolicy.x86_64 0:2.5-4.el7 will be installed ---> Package libcgroup.x86_64 0:0.41-13.el7 will be installed ---> Package libsemanage-python.x86_64 0:2.5-8.el7 will be installed ---> Package python-IPy.noarch 0:0.75-6.el7 will be installed ---> Package setools-libs.x86_64 0:3.3.8-1.1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =========================================================================================================== Package Arch Version Repository Size =========================================================================================================== Installing: policycoreutils-python x86_64 2.5-17.1.el7 base 446 k Installing for dependencies: audit-libs-python x86_64 2.7.6-3.el7 base 73 k checkpolicy x86_64 2.5-4.el7 base 290 k libcgroup x86_64 0.41-13.el7 base 65 k libsemanage-python x86_64 2.5-8.el7 base 104 k python-IPy noarch 0.75-6.el7 base 32 k setools-libs x86_64 3.3.8-1.1.el7 base 612 k Transaction Summary =========================================================================================================== Install 1 Package (+6 Dependent packages) Total download size: 1.6 M Installed size: 5.1 M Downloading packages: (1/7): audit-libs-python-2.7.6-3.el7.x86_64.rpm | 73 kB 00:00:00 (2/7): libsemanage-python-2.5-8.el7.x86_64.rpm | 104 kB 00:00:00 (3/7): python-IPy-0.75-6.el7.noarch.rpm | 32 kB 00:00:00 (4/7): checkpolicy-2.5-4.el7.x86_64.rpm | 290 kB 00:00:00 (5/7): setools-libs-3.3.8-1.1.el7.x86_64.rpm | 612 kB 00:00:00 (6/7): policycoreutils-python-2.5-17.1.el7.x86_64.rpm | 446 kB 00:00:00 (7/7): libcgroup-0.41-13.el7.x86_64.rpm | 65 kB 00:00:01 ----------------------------------------------------------------------------------------------------------- Total 1.4 MB/s | 1.6 MB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : setools-libs-3.3.8-1.1.el7.x86_64 1/7 Installing : checkpolicy-2.5-4.el7.x86_64 2/7 Installing : libcgroup-0.41-13.el7.x86_64 3/7 Installing : python-IPy-0.75-6.el7.noarch 4/7 Installing : audit-libs-python-2.7.6-3.el7.x86_64 5/7 Installing : libsemanage-python-2.5-8.el7.x86_64 6/7 Installing : policycoreutils-python-2.5-17.1.el7.x86_64 7/7 Verifying : libsemanage-python-2.5-8.el7.x86_64 1/7 Verifying : audit-libs-python-2.7.6-3.el7.x86_64 2/7 Verifying : python-IPy-0.75-6.el7.noarch 3/7 Verifying : policycoreutils-python-2.5-17.1.el7.x86_64 4/7 Verifying : libcgroup-0.41-13.el7.x86_64 5/7 Verifying : checkpolicy-2.5-4.el7.x86_64 6/7 Verifying : setools-libs-3.3.8-1.1.el7.x86_64 7/7 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 Complete!
Setelah instalasi selesai, jalankan semanage untuk melihat apakah tersedia atau tidak.
semanage port -a -t mongod_port_t -p tcp 27017
Sekarang, Anda seharusnya tidak melihat kesalahan apa pun.
Itu saja.