centos 关闭FireWall 和SELinux的方法,centosselinux
centos 关闭FireWall 和SELinux的方法,centosselinux
1. 环境
centos-7.x 选择最完整版安装(workstation选项) VMware Workstation 10.0.0
2. 关闭FireWall和SELinux
2.1 FireWall
使用systemctl status firewalld查看防火墙的状态,如下(默认开启)
[root@localhost ~]# systemctl status firewalld // 防火墙状态 ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since 三 2018-03-28 07:07:33 CST; 7h left Docs: man:firewalld(1) Main PID: 1055 (firewalld) CGroup: /system.slice/firewalld.service └─1055 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid ..... .....
如果你需要使用FireWall服务(正式环境下),则需要修改它的配置,因为在默认情况下,它会拦截大多数服务请求。具体可以参考配置firewalld服务的基本操作和设置。
如果由于某些原因(比如博主只是需要linux服务器来搭建某些服务,不想控制防火墙只开放某些端口)等而不需要FireWall服务,则可以像下面那样停止并禁用它。
// 关闭服务 [root@localhost ~]# systemctl stop firewalld // 关闭开机自动开启FireWall服务 [root@localhost ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
2.2 关闭SELinux
可以用getenforce 查看SELinux的状态,如下(默认开启)
[root@localhost ~]# getenforce //开启状态 Enforcing
同上,如果你想使用SELinux也可以。但是博主不想那么麻烦,所以把SELinux也关闭了。
[root@localhost ~]# vi /etc/selinux/config # 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. // 这里改变为disabled SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted // 重启使配置生效 [root@localhost ~]# reboot
3. 错误集锦
切换成root用户操作
评论暂时关闭