centos7与centos6命令差异

查看ip

centos6 : ifconfig
centos7 : ip addr

修改hostname

centos6 : 修改/etc/sysconfig/network
centos7 : 修改/etc/hostname,也可以直接使用命令 hostnamectl set-hostname yourhostname

修改ip

centos6: vim /etc/sysconfig/network-scripts/ifcfg-eth0
centos7: vim /etc/sysconfig/network-scripts/ifcfg-ens33

服务相关

centos6: service servicename start/stop/restart/status/reload
centos7: systemctl start/stop/restart/status/reload servicename

开启关闭防火墙

centos6:
1.永久有效

开启: chkconfig iptables on
关闭: chkconfig iptables off
2.即刻生效

开启: service iptables start
关闭: service iptables stop
3.开启部分端口

vim /etc/sysconfig/iptables
添加想要开启的相关端口

-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8082 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart

centos7:
1 启动:systemctl start firewalld.service
2 关闭:systemctl stop firewalld.service
3 重启:systemctl restart firewalld.service
4 显示状态:systemctl status firewalld.service
5 在开机时启动:systemctl enable firewalld.service
6 永久禁用:systemctl disable firewalld.service
7 查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
8 查看已启动的服务列表:systemctl list-unit-files|grep enabled

后续有了再补充

centos6:
centos7:

centos6:
centos7:

你可能感兴趣的:(centos,linux)