记录一下centos 7.3 semanage 使用报错。处理

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

[root@LENOVO-LA0X1 conf]# semanage -h
ERROR: policydb version 31 does not match my version range 15-30
ERROR: Unable to open policy //etc/selinux/targeted/policy/policy.31.
Traceback (most recent call last):
  File "/usr/sbin/semanage", line 32, in 
    import seobject
  File "/usr/lib/python2.7/site-packages/seobject/__init__.py", line 36, in 
    import sepolicy
  File "/usr/lib64/python2.7/site-packages/sepolicy/__init__.py", line 907, in 
    raise e
ValueError: 读取 //etc/selinux/targeted/policy/policy.31 策略文件失败

使用centos 7.3 修改apachect端口为88时,发现无法重启。

网上查文章说是SELinux对端口限制,需要去配置端口号。使用semanage来对端口号进行管理,但是semanage一直无法使用,执行如上。以下给出方法:

[root@LENOVO-LA0X1 conf]# yum provides semanage
Failed to set locale, defaulting to C
??????fastestmirror, langpacks
Loading mirror speeds from cached hostfile
policycoreutils-python-2.5-29.el7.x86_64 : SELinux policy core python utilities
?    ?base
?????
???    ?/usr/sbin/semanage



policycoreutils-python-2.5-29.el7_6.1.x86_64 : SELinux policy core python utilities
?    ?updates
?????
???    ?/usr/sbin/semanage



policycoreutils-python-2.5-8.el7.x86_64 : SELinux policy core python utilities
?    ?@anaconda
?????
???    ?/usr/sbin/semanage
[root@LENOVO-LA0X1 conf]# yum -y install policycoreutils-python.x86_64

自此,可以使用了。

转载于:https://my.oschina.net/u/931071/blog/3023721

你可能感兴趣的:(记录一下centos 7.3 semanage 使用报错。处理)