CentOS时间错误如何同步网络时间

zhuanbike 2021-10-30 810

首先通过date命令查看当前时间,如过与实际时间不一致则修改。

如果没有安装ntp则需要安装


  1. 安装ntpdate工具yum -y install ntp ntpdate

  2. 设置系统时间与网络时间同步ntpdate cn.pool.ntp.org

  3. 将系统时间写入硬件时间hwclock --systohc

[root@www ~]# timedatectl status
      Local time: 四 2021-10-28 19:24:59 CST
  Universal time: 四 2021-10-28 11:24:59 UTC
        RTC time: 四 2021-10-28 19:24:59
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@www ~]# ntpdate cn.pool.ntp.org
30 Oct 16:20:02 ntpdate[1144]: step time server 119.28.183.184 offset 159697.600720 sec
[root@www ~]# hwclock --systohc
[root@www ~]# date
2021年 10月 30日 星期六 16:20:30 CST
[root@www ~]#


最新回复 (0)
发新帖