centos6和centos7中常用命令区别
以前一直接触的是centos6,最近因为新项目接触到centos7,发现有些命令还是有差异的(从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig),现总结如下:
防火墙相关命令:
centos6:
查看防火墙状态:service iptables status
关闭防火墙:service iptables stop (临时关闭)
chkconfig iptables off (永久关闭)
centos7:
查看防火墙默认状态:firewall-cmd --state
检查防火墙的状态:
systemctl list-unit-files|grep firewalld.service 或者 systemctl status firewalld.service
centos7默认使用的是firewall作为防火墙,使用iptables必须重新设置一下
1、直接关闭防火墙:
systemctl stop firewalld.service (停止firewall)
systemctl disable firewalld.service (禁止firewall开机启动)
2、设置iptables service
yum -y install iptables-services
如果要修改防火墙配置,如增加防火墙端口3306
vi /etc/sysconfig/iptables
增加规则
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
保存退出后
systemctl restart firewalld.service 重启防火墙使配置生效
systemctl enable firewalld.service 设置防火墙开机启动
最后重启系统使设置生效即可
如下截图:防火墙处于关闭状态

centos6和centos7中常用命令区别的更多相关文章
- CentOS7 中常用命令
1.开放端口 开放50070端口 firewall-cmd --zone=public --add-port=50070/tcp --permanent 关闭50070端口 firewall-cmd ...
- web 架构 /http协议,状态码,django中常用命令
什么是web应用? web应用 架构 :B/S架构 | C/S架构 网站:BS架构其实就是应用程序: B是浏览器 S是sever(实现了wsgi协议,实现了socket的服务端) + applicat ...
- centos6 和centos7 安装git 的区别
centos6 和centos7 安装git 的区别 centos6安装git yum install curl-devel expat-devel gettext-devel openssl-dev ...
- 【CentOS7】常用命令
[CentOS7]常用命令 转载:https://www.cnblogs.com/yangchongxing/p/10646640.html 目录 ========================== ...
- 学习Git过程中常用命令的总结
复制远程库git clone git@github.com:Hconly/learngit.git在GitHub上,可以任意Fork开源仓库:自己拥有Fork后的仓库的读写权限:可以推送pull re ...
- Django中常用命令
Django 基本命令 熟练使用Django常用命令能让你事半功倍!!!! 1. 新建一个 django project django-admin.py startproject project-na ...
- git 工作中常用命令(结合vscode学习git 命令)
作为一名前端开发,大家在工作中常常使用什么开发工具呢,我觉得我首选的是vscode,他配合git使用起来非常方便. 工作中常用三个命令: git终端常使用: git add . git commit ...
- Linux中常用命令(文件与目录)
1.pwd 查看当前目录(Print Working Directory) 2.cd 切换工作目录(Change Directory) (1)格式:cd [目录位置] 特殊目录: .当前目录 ..上一 ...
- Centos7防火墙常用命令
有些人安装的linux的系统默认防火墙不是iptables,而是firewall,那就得使用以下方式关闭防火墙了. >>>关闭防火墙 systemctl stop firewalld ...
随机推荐
- 【转载】C#中将字符串分割成字符数组
在C#中字符串类型String是由一系列的单个字符组合而成,其实可以通过字符串String对象ToCharArray()方法来将字符串中的元素逐一存在数据类型为Char的一维数组中. 例如将字符str ...
- element-ui默认样式修改
来自 :https://blog.csdn.net/wangguoyu1996/article/details/81394707 侵删 我们在使用element-ui的时候经常会遇到需要修改组件默认样 ...
- css 盒子 取值
盒子:当我们设置一个标签宽高时,默认设置的是盒子里面content大小. 内容盒:content 填充盒:content+padding(overflow截取的区域) 边框盒:content+padd ...
- jquery判断数据类型源码解读
var class2type = {}; ("Boolean Number String Function Array Date RegExp Object Error").spl ...
- U盘因格式化 NTFS 中断造成无法识别,生产平台同样无法识别的修复处理方案
特征: 电脑设备管理器(win10):识别到大容量存储设备 电脑磁盘管理:识别可移动磁盘无媒体 ChipGenius(v4_19_0319):能识别到制造商,但识别不到芯片具体型号 U盘相关生产平台: ...
- arm-none-eabi/bin/ld: build/com.zubax.gnss.elf section `.text' will not fit in region `flash'
出现如下错误: /arm-none-eabi/bin/ld: build/com.zubax.gnss.elf section `.text' will not fit in region `flas ...
- sql 四舍五入 保留两位小数
一.问题描述 数据库里的 float momey 类型,都会精确到多位小数.但有时候 我们不需要那么精确,例如,只精确到两位有效数字. 二.sqlserver解决方案: 1. 使用 Round() 函 ...
- Vue框架之vuex的使用
1.首先需要在你的项目目录下安装vuex 终端命令: 2.在全局组件中导入与声明vuex 3.创建store实例对象 let store = new Vuex.store({ state:{ }, m ...
- 【OF框架】缓存Session/Cookies/Cache代码调用api,切换缓存到Redis
准备 缓存服务在应用开发中最常用的功能,特别是Session和Cookies,Cache部分业务开发过程会使用到. 在负载均衡环境下,缓存服务需要存储到服务器. 缓存默认实现在内存在,可以通过配置切换 ...
- docker 安装elk
https://www.cnblogs.com/fbtop/p/11005469.html