最近在一台旧电脑上安装了Debian 10 "Buster“,现在它显示的$ date输出比以前少了1小时。
如何与NTP GMT -3,美国/累西腓时区同步系统时间?
发布于 2019-10-10 15:09:59
要验证系统的时区(我的是欧洲/柏林),请运行
$ cat /etc/timezone
Europe/Berlin如果它是错误的,运行
sudo dpkg-reconfigure tzdata然后选择America,然后Recife并检查打印的本地时间现在是否正确。
您还可以打印UTC日期
date -u这应该是你当地的时间+3小时。
发布于 2019-10-10 13:57:34
您应该能够使用ntp或ntpdate来完成此操作。
apt install ntpdate
ntpdate pool.ntp.orgntpdate对于一次性同步非常有用。而ntp守护进程将在后台运行,并保持时钟更新:
apt install ntp
cat <<EOF >/etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
server pool.ntp.org
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
EOF
systemctl start ntp
systemctl enable ntp虽然你可能只是使用了错误的时区。GMT-3的一些例子:
ln -sf /usr/share/zoneinfo/America/Argentina/Buenos_Aires /etc/localtime发布于 2019-10-10 14:03:58
https://unix.stackexchange.com/questions/546155
复制相似问题