Debian 使用 Chrony 自动同步时间

Author Avatar
青枫 2024年03月21日
  • 在其它设备中阅读本文章

1. 安装 Chrony

apt install chrony -y

2. 配置 Chrony 服务

一般来说,配置文件无需改动就能正常使用。当然为了加快同步速度,可以使用国内的 NTP 服务器。

vi /etc/chrony/chrony.conf

chrony.conf

将 pool 2.debian.pool.ntp.org iburst iburst 修改为 pool time.pool.aliyun.com iburst

更多公共 NTP 服务器请参考: 公共 NTP 服务器地址大全

3. 重启 Chrony 服务

systemctl restart chrony

4. 验证状态

chronyc sources

相关常用命令

1. 查看系统时间

date

2. 强制同步系统时间

chronyc -a makestep

3. 查看时间同步源

chronyc sources -v

4. 查看时间同步源状态

chronyc sourcestats -v