centos7与centos6主要区别点
centos7与centos6主要区别点
20180621 Chenxin 整理
配置systemctl命令tab自动补全
yum install -y bash-completion 安装完成后退出终端重新连接服务器后生效
服务相关命令
systemctl管理服务的启动、重启、停止、重载、查看状态的命令:
Sysvinit命令(RHEL6)
Systemctl命令(RHEL7)
作用
service name start
systemctl start name.service
启动服务
service name restart
systemctl restart name.service
重启服务
service name stop
systemctl stop name.service
停止服务
service name reload
systemctl reload name.service
重新加载配置文件(不终止服务)
service name status
systemctl status name.service
查看服务状态
systemctl设置服务的开机启动、不启动、查看各级别下服务启动状态的命令:
Sysvinit命令(RHEL6)
Systemctl命令(RHEL7)
作用
chkconfig name on
systemctl enable name.service
开机自动启动
chkconfig name off
systemctl disable name.service
开机不自动启动
chkconfig name
systemctl is-enabled name.service
查看特定服务是否为开机自启动
chkconfig --list
systemctl list-unit-files --type=service
查看各个级别下服务的启动情况
chkconfig --list systemctl -t service --state=active 服务列表查看
单用户与多用户以及selinux开启关闭文件
rhel6
rhel7
说明
cat /etc/inittab
systemctl get-default
1为单3或5为多用户
vim /etc/inittab ->3
systemctl set-default multi-user.target
切换多用户与单用户
/etc/selinux/config
/etc/sysconfig/selinux->/etc/selinux/config
开启关闭selinux文件
RHEL7和RHEL6的主要变化(详细)
RHEL7和RHEL6的主要变化
系统版本
RHEL7
RHEL6
进程名称
systemd
init
运行级别
runlevel3.target->multi-user.target
/etc/systemd/system/default.target
runlevel3
/etc/inittab
主机名称
/etc/hostname
/etc/sysconfig/network
服务启动
Systemd
Upstart
服务管理
systemctl enable xxx.service
systemctl start xxx.service
systemctl stop xxx.service
systemctl restart xxx.service
兼容chkconfig,service命令
service enable xxx.service
service stop xxx.service
service start xxx.service
chkconfig --level 3 5 nfs on
RHEL7和RHEL6的管理命令和配置文件的变化
基本配置
RHEL7
RHEL6
网络配置工具
nmcli nmtui nm-connection-editor
system-config-network
语言配置工具
localectl
system-config-language
时间配置工具
timedatectl date
system-config-date date
时间同步
ntpdate /etc/chrony.conf
ntpdate /etc/ntp.conf
服务管理
RHEL7
RHEL6
服务列表
systemctl -at service
ls /{usr/lib,etc}/systemd/system/.service
chkconfig
ls /etc/init.d/
服务启动
systemctl start name.service
service name start
服务停止
systemctl stop name.service
service name stop
服务查看
systemctl status name.service
service name status
服务重启
systemctl restart name.service
service name restart
服务开机自启
systemctl enable name.service
chkconfig name on
服务开机不自启
systemctl disable name.service
chkconfig name off
添加服务
systemctl daemon-reload
chkconfig --add
服务列表查看
systemctl -t service --state=active
service --status-all
查看运行级别
systemctl get-default
runlevel
修改运行级别
systemctl isolate name.target
init runlevel
init runlevel
日志文件
/etc/rsyslog.conf
/etc/rsyslog.d/.conf
/var/log/journal/
/etc/systemd/journald.conf
/etc/rsyslog.conf
查看日志文件
/var/log/
/var/log/journalctl
内核硬件
RHEL7
RHEL6
关闭系统
systemctl shutdown
shutdown
关闭电源
systemctl poweroff
poweroff
挂起系统
systemctl halt
halt
重启系统
systemctl reboot
reboot
修改运行级别
systemctl set-default
/etc/inittab
配置GRUB
/etc/default/grub
grub2-mkconfig ;grub-set-default
/boot/grub/grub.conf
网络接口配置
RHEL7
RHEL6
配置名称
/etc/hosts
/etc/resolv.conf
nmcli conmod
/etc/hosts
/etc/resolv.conf
主机名称配置
/etc/hostname
hostnamectl
nmcli
/etc/sysconfig/network
Ip地址配置
ip addr;ifconfig;
nmcli dev show;
teamdctl ;brctl ;bridge
ip add;ifconfig
brctl
配置防火墙
firewall-cmd
firewall-config
iptables&ip6tables
/etc/sysconfig/ip*tables
system-config-firewall
查看端口命令
ss ;lsof
netstat
ss ; lsof
其他发现文件
语言:
在rhel7中系统的默认编码设置文件,由/etc/sysconfig/i18n更改为/etc/locale.conf该文件主定义了你当前系统的语言环境变量等设置
cat /etc/locale.conf
LANG="en_US.UTF-8"
时区:
在 rhel7中, 引入了一个叫 timedatectl 的设置设置程序.
用法很简单:
timedatectl # 查看系统时间方面的各种状态
timedatectl list-timezones # 列出所有时区
timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
/bin/cp -aprf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #不考虑各个发行版的差异化, 从更底层出发的话, 修改时间时区比想象中要简单
关于各个"单元"的状态说明
systemctl list-unit-files --type=service
这个列表显示每个配置文件的状态,一共有四种:
- enabled:已建立启动链接
- disabled:没建立启动链接
- static:该配置文件没有[Install]部分(无法执行),只能作为其他配置文件的依赖
- masked:该配置文件被禁止建立启动链接 (不常见)
systemctl -t service --state=active

浙公网安备 33010602011771号