今天新装的一台机器,需要安装vnstat做流量统计和监控,关于vnstat的介绍和安装,详见我的博客:https://blog.terrynow.com/2021/04/12/linux-network-monitor-tool-vnstat/
在启动vnstat后(systemctl start vnstat),发现vnstat的状态是启动失败(systemctl status vnstat),错误信息如下:
ExecStart=/usr/sbin/vnstatd -n (code=exited, status=238/STATE_DIRECTORY)
重新启动服务(systemctl restart vnstat)后,升级重启服务器,也一样,无效果,经过一番折腾,发现是selinux的问题,默认安装的CentOS的selinux是enforcing
尝试将其关闭:编辑/etc/selinux/config文件,将SELINUX=enforcing修改为:SELINUX=disabled,
如下:
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. # 修改如下:SELINUX=disabled 之前是SELINUX=enforcing SELINUX=disabled # SELINUXTYPE= can take one of these three values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
保存重启电脑,问题解决!
看来selinux问题真的很多,之前就遇到几个奇奇怪怪的问题,也是selinux引起的,难怪其他几个Linux发行版都不搞这些!现在装完机器第一件事情就是先关selinux!
文章评论