如何让linux时间与internet时间同步(centos7)?
下面来看看这几个步骤
一、时区
设置系统时区为上海
# timedatectl set-timezone Asia/Shanghai
二、同步网络时间
1、查看系统时间
# date -R
2、显示硬件时间
# hwclock
3、安装ntpdate工具
# yum install -y ntpdate
4、设置系统时间与网络时间同步(我使用是 2.asia.pool.ntp.org)
# ntpdate 0.asia.pool.ntp.org
# ntpdate 1.asia.pool.ntp.org
# ntpdate 2.asia.pool.ntp.org
# ntpdate 3.asia.pool.ntp.org
5、将系统时间写入到系统硬件当中
# hwclock --systohc
6、强制系统时间写入CMOS中防止重启失效
# hwclock -w 或 clock -w
7、编辑时间配置文件每个2天同步一次
# vi /etc/crontab
* */48* * * ntpdate 2.asia.pool.ntp.org