1.设置ntp服务器

vi /etc/chrony.conf

修改server如下:

server 0.cn.pool.ntp.org iburst
server 1.cn.pool.ntp.org iburst
server 2.cn.pool.ntp.org iburst
server 3.cn.pool.ntp.org iburst

2.设置时区

timedatectl set-timezone Asia/Shanghai

3.开启时间同步

timedatectl set-ntp true

4.查看设置结果

timedatectl

如果显示内容如下,说明设置成功

      Local time: Thu 2025-07-31 15:23:39 CST
  Universal time: Thu 2025-07-31 07:23:39 UTC
        RTC time: Thu 2025-07-31 07:23:39
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

标签: none

添加新评论