区别1 网络管理
1.1 网卡名称
CentOS的网卡名称:
centos6的网卡名称eth0
centos7的网卡名称ens33
1.2 网络服务
CentOS7保留了service可以管理network
CentOS7保留了两个chkconfig的服务:
1.3 设置static的ip地址
vim /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT="yes"
BOOTPROTO="static"
ADDR=192.168.255.99(IP地址)
GATEWAY=192.168.255.2(网关)
DNS1=192.168.255.2(域名解析)
然后重启网络服务:
service network restart
区别2 服务管理
2.1 服务指令
CentOS7采用新的指令systemctl
进行服务管理。
systemctl start|stop|restart|status 服务名
service
保留了两个两个网络的服务
2.2 服务名
防火墙:
CentOS6:iptables
CentOS7:firewalld
CentOS6网络防火墙操作:
关闭防火墙服务
service iptables stop
开启防火墙服务
service iptables start
重启防火墙服务
service iptables restart
查看防火墙状态
service iptables status
关闭防火墙开机自启
chkconfig iptables off
开启防火墙开机自启
chkconfig iptables on
查看防火墙自启状态
chkconfig --list |grep iptables
CentOS7关闭网络防火墙:
关闭防火墙服务
systemctl stop firewalld
开启防火墙服务
systemctl start firewalld
重启防火墙服务
systemctl restart firewalld
查看防火墙状态
systemctl status firewalld
查看防火墙自启状态
systemctl list-unit-files | grep firewalld
关闭防火墙开机自启
systemctl disable firewalld
开启防火墙开机自启
systemctl enable firewalld
区别3 主机名设置
CentOS6:
vim /etc/sysconfig/network
CentOS7:
vim /etc/sysconfig/hostname
修改hosts映射指令不变
vim /etc/hosts
区别4 运行级别
CentOS6:7个运行级别
cat /etc/inittab
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
CentOS7:2个运行级别
但是仍然能够通过init n 进行切换运行级别。
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
区别5 修改root密码
CentOS6:
在系统启动时按enter进入:
CentOS7:
1.重启Linux,见到下图,通过键盘上下方向键选择第一个
2.按e,出现如图5-9所示的界面
3.定位到LANG=zh_CN.UTF-8,后面追加 init=/bin/sh
4.键盘ctrl+x进行引导启动,进入如下界面
5. 挂载根目录
6. 选择要修改密码的用户名,passwd root, 然后输入两次一致的密码,依次回车。
注意: 输入密码不显示,一定要确认输入正确.
7. 更新系统信息 touch /.autorelabel
8.最后输入exec /sbin/init 命令重启系统即可