131 字
1 分钟
Linux 服务器时间同步配置(Chrony)
2026-01-03

服务器时间同步非常重要,数据库、缓存、日志、监控等服务都依赖准确的时间。随着运行时间增长,系统时钟会产生漂移,建议通过 Chrony 定期同步。

一、设置时区#

sudo timedatectl set-timezone Asia/Shanghai

二、安装 Chrony#

# CentOS / RHEL
yum install -y chrony
# Ubuntu / Debian
apt install -y chrony
TIP

如果服务器无法直连公网,可先配置 HTTP 代理再安装:

export http_proxy=http://192.168.1.87:3128
export https_proxy=http://192.168.1.87:3128

三、配置 NTP 服务器#

/etc/chrony.conf
# 内网 NTP 服务器(优先)
server 192.168.1.244 iburst
# 国内公共 NTP 源(备用)
server ntp.aliyun.com iburst
server time1.cloud.tencent.com iburst
server ntp1.aliyun.com iburst
server ntp.sjtu.edu.cn iburst
server cn.ntp.org.cn iburst

四、启动服务#

systemctl enable chronyd --now
systemctl status chronyd

五、验证时间同步#

# 查看同步跟踪状态
chronyc tracking
# 查看时间源列表
chronyc sources -v

六、启用 NTP 并查看状态#

timedatectl set-ntp true
timedatectl
分享

如果这篇文章对你有帮助,欢迎分享给更多人!

Linux 服务器时间同步配置(Chrony)
https://blog.olinl.com/posts/chrony-time-sync/
作者
顾拾柒
发布于
2026-01-03
许可协议
CC BY-NC-SA 4.0

目录