CentOS7 时间与网络时间同步
yum -y install ntp ntpdate #安装ntpdate工具
ntpdate 0.asia.pool.ntp.org #设置系统时间与网络时间同步
这里主要就是通过时间服务器对系统时间进行同步,所以0.asia.pool.ntp.org并不是固定的,大家可以选择time.nist.gov、time.nuri.net、0.asia.pool.ntp.org、1.asia.pool.ntp.org、2.asia.pool.ntp.org、3.asia.pool.ntp.org中任意一个,只要保证可用就OK。
hwclock --systohc #将系统时间写入硬件时间
timedatectl
hwclock -w
或clock -w #强制系统时间写入CMOS中防止重启失效