• Centos 7 主要命令改动 service chkconfig iptables


    1.service、chkconfig => systemctl

    seivice和chkconfig 是linux上的常用命令在centos7上被systemctl代替。

           CentOS 7 使用systemd替换了SysV。Systemd目的是要取代Unix时代以来一直在使用的init系统,兼容SysV和LSB的启动脚本,而且够在进程启动过程中更有效地引导加载服务。 

    systemd的特性有:

    • 支持并行化任务;
    • 同时采用socket式与D-Bus总线式激活服务;
    • 按需启动守护进程(daemon);
    • 利用 Linux 的 cgroups 监视进程;
    • 支持快照和系统恢复;
    • 维护挂载点和自动挂载点;
    • 各服务间基于依赖关系进行精密控制。

    我们对service和chkconfig两个命令都不陌生,systemctl 是管制服务的主要工具, 它整合了chkconfig 与 service功能于一体。

    systemctl is-enabled iptables.service

    systemctl is-enabled servicename.service #查询服务是否开机启动


    systemctl enable xxx.service #开机运行服务
    systemctl disable xxx.service #取消开机运行

    systemctl start xxx.service #启动服务
    systemctl stop xxx.service #停止服务
    systemctl restart xxx.service #重启服务

    systemctl reload xxx.service #重新加载服务配置文件
    systemctl status xxx.service #查询服务运行状态
    systemctl --failed #显示启动失败的服务

    注:xxx代表某个服务的名字,如http的服务名为httpd

     

    例如在CentOS 7


    启动服务(等同于service httpd start)
    systemctl start httpd.service

    停止服务(等同于service httpd stop)
    systemctl stop httpd.service

    重启服务(等同于service httpd restart)
    systemctl restart httpd.service

    查看服务是否运行(等同于service httpd status)
    systemctl status httpd.service

    开机自启动服务(等同于chkconfig httpd on)
    systemctl enable httpd.service

    开机时禁用服务(等同于chkconfig httpd on)
    systemctl disable httpd.service

    查看服务是否开机启动 (等同于chkconfig --list)
    systemctl is-enabled httpd.service 

     

     

    2. iptables=>firewall
    一些重要的服务 centos7 也做了修改   例如 iptables

    CentOS 7.0默认使用的是firewall作为防火墙,代替了以前的iptables
    关闭firewall:
    systemctl stop firewalld.service                #停止firewall
    systemctl disable firewalld.service           #禁止firewall开机启动
     
     
     
     
    3.ext=>XFS
    以往的centos使用的文件系统是  ext2/ext3/ext4   
    其对应的的调整命令是resize2fs

    CentOS7.0的默认文件系统类型是Xfs 其对应的调整命令是 xfs_growfs 不同文件系统类型对应的创建、检查、调整命令不同,要注意区分。

     
     
     
     
    4. 查看IP地址  也进行了修改
    CentOS 7.0  使用ifconfig 提示无此命令
    可以使用 ip命令 
     
    1.设置、查看和删除IP地址:
    设置IP地址——
    ip addr add 192.168.1.1/24 dev eth0
    查看IP地址——
     ip addr
    ip addr show eth0
    删除IP地址——
    ip addr del 192.168.1.1 dev eth0
     
    2.修改路由:
    查看路由表——
    ip route show
    查看路由包来自的接口(本地接口)——
    ip route get 123.125.114.144
    更改默认路由——
    ip route add default via 192.168.1.254
     
    3.显示网络信息:
    显示网络统计信息——
    ip -s link
    查看ARP条目——
    ip neigh(或neighbour)
    监控netlink消息——
    ip monitor all
     
    4.激活或停止网络接口:
    激活网络接口——
    ip link set eth0 up
    停止网络接口——
    ip link set eth0 down
     
        好吧,用惯ifconfig的我着实花了点时间来熟悉这玩意儿。另外,
    netstat命令也被ss命令取代了!
  • 相关阅读:
    错误: 找不到或无法加载主类/java BB.class 中文乱码
    如何新建git仓库并连接以及git branch相关命令
    String、StringBuffer与StringBuilder区别
    HTML选择器
    java中的system.out.println()和JSP中out.println()区别
    校园双选会,你都懂么
    android visible invisible和gone的区别
    Android 显示意图和隐式意图的区别
    android doGet和doPost
    Android 监听SMS短信
  • 原文地址:https://www.cnblogs.com/centos2017/p/7896788.html
Copyright © 2020-2023  润新知