zoukankan      html  css  js  c++  java
  • 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  设置防火墙开机启动

    最后重启系统使设置生效即可

    如下截图:防火墙处于关闭状态

  • 相关阅读:
    bzoj1042: [HAOI2008]硬币购物(DP+容斥)
    bzoj3680: 吊打XXX(模拟退火)
    bzoj1867: [Noi1999]钉子和小球(DP)
    iOS怎样获取任何App的资源图片?
    iOS常用第三方库
    iOS应用上架报错解决
    iOS视频直播用到的协议
    iOS开发常用第三方框架
    iOS 打包Framework包含其他Framework的问题
    http和https的区别
  • 原文地址:https://www.cnblogs.com/pistachio123/p/11081823.html
Copyright © 2011-2022 走看看