centos 关闭FireWall 和SELinux(包含图文)

news/2024/7/7 14:35:28 标签: linux, centos, firewall, selniux, 环境部署

1. 环境

  • centos-7.x 选择最完整版安装(workstation选项)
  • VMware Workstation 10.0.0

firewall和selinux">2. 关闭FireWall和SELinux

firewall">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.

linux">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用户操作

http://www.niftyadmin.cn/n/898545.html

相关文章

Spring Boot基础教程:使用IDEA中的Spring Initializr来快速构建Spring Boot工程

1. 前言 想要使用Spring Boot进行开发,那么第一步便是创建一个Spring Boot工程。创建Spring Boot的方式有很多,在这里介绍一种快捷的创建项目方式。本文我们将使用IDEA的Spring Initializr工具,它可以帮助我们快速构建一个基础的Spring Boot…

Spring Boot基础教程:创建一个spring-hello-world

1. 前言 Spring Boot简化了基于Spring的应用开发,你只需要“run”就能创建一个独立的,产品级别的Spring应用。其为Spring应用平台以及第三方库提供了开箱即用的设置,多数Spring Boot应用只需要很少的Spring配置。 我们可以使用多种方式来创…

jobconverter文档详解

1. 入门指南 简介 JODConverter是一种Java OpenDocument转换器,能够转换不同格式的文档,它依赖于Apache OpenOffice或 LibreOffice ,它为OpenDocument和Microsoft Office提供了最好的免费导入/导出的过滤器。 JODConverter自动支持OpenOffi…

Spring Boot基础教程:构建spring-rest-curd + 单元测试

1. 简介 在学习了如何快速创建一个Spring Boot项目和简单使用Spring Boot搭建web项目,接下来要学习的是如何将在mvc模式中使用,本文完成了一个RESTful API curd的简单例子,并使用TestRestTemplate来进行junit测试。 2. 环境 使用环境参考…

Spring Boot基础教程:使用spring-data-jpa-h2进行数据访问

1. 前言 本节讲解如何使用spring-data-jpa来访问数据,通过内存数据库h2来存储数据。在这个过程中,我们将了解到: spring-data-jpa的特点和强大之处如何使用内存数据库h2 2. 环境要求 使用环境参考Spring Boot基础教程汇总中的讲解&#…

Spring Boot基础教程:使用spring-boot-jpa-mysql进行数据访问

1. 前言 本小节讲解的是,如何在Spring Boot中配置mysql连接,并用spring-data-jpa对pojo进行操作,存库。 2. 环境要求 使用环境参考Spring Boot基础教程汇总中的讲解:详情请点击 3. 快速开始 使用maven构建项目 项目结构如下…

leetCode汇总

java-leet-code 持续更新leet-code题解 explore(30) #TitleTag001Two SumArray HashTable007Reverse IntegerString008String to IntegerString Array014Longest Common PrefixString Array019Remove Nth Node From End of ListLinkedList021Merge Tw…

hashMap.containsKey(value)时间复杂度分析

1. 分析hashMap.containsKey hashMap.containsKey(value)的时间复杂度为什么是O(1)呢&#xff1f;这个就要来看一下源码了 /*** Returns <tt>true</tt> if this map contains a mapping for the* specified key.** param key The key whose presence in this …