如何基于Debian部署chrony时间同步?
1 NTP服务端配置
sudo apt install -y chrony
sudo tee /etc/chrony/chrony.conf <<-'EOF'
confdir /etc/chrony/conf.d
# 配置时间同步源
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
# 允许任意IP,从本机同步时间
allow 0.0.0.0/0
sourcedir /run/chrony-dhcp
sourcedir /etc/chrony/sources.d
keyfile /etc/chrony/chrony.keys
driftfile /var/lib/chrony/chrony.drift
ntsdumpdir /var/lib/chrony
logdir /var/log/chrony
maxupdateskew 100.0
rtcsync
makestep 1 3
leapsectz right/UTC
EOF
systemctl enable chrony && systemctl restart chrony
chronyc sources
2 NTP客户端配置
apt install -y ntpdate
(crontab -l ; echo "5 * * * * ntpdate 服务端IP") | crontab -