首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu核中的NTP同步

Ubuntu核中的NTP同步
EN

Ask Ubuntu用户
提问于 2016-07-05 14:24:10
回答 2查看 1.3K关注 0票数 0

如何在Ubuntu (版本10)中配置正确的NTP同步。

我正在运行以下版本:

ubuntu-core 2016-05-24 10 ubuntu

我试着用:

root@localhost:/home/ubuntu# sudo timedatectl Local time: Tue 2016-07-05 14:16:50 UTC Universal time: Tue 2016-07-05 14:16:50 UTC RTC time: Tue 2016-07-05 14:16:51 Time zone: Etc/UTC (UTC, +0000) NTP enabled: no NTP synchronized: no RTC in local TZ: no DST active: n/a

我确实启用了NTP。即使在重新启动之后我也没有同步。我认为这是因为没有配置适当的NTP服务器:

root@localhost:/home/ubuntu# cat /etc/systemd/timesyncd.conf [Time]

#NTP= *#FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org

这个文件只给我看。我被困在这里-任何帮助都是非常感谢的。

EN

回答 2

Ask Ubuntu用户

发布于 2016-07-29 06:46:20

最好只安装这个ntp服务器快照:

代码语言:javascript
复制
sudo snap install ntpserver
票数 0
EN

Ask Ubuntu用户

发布于 2018-10-30 09:57:53

在最近版本的Ubuntu上,该文件不再是只读的,可以在NTP=选项中插入一个以空格分隔的服务器列表。

如果您想要自动修复它:

代码语言:javascript
复制
sed 's/^#*NTP=.*$/NTP=ntp.domain.com ntp2.domain.com/' /etc/systemd/timesyncd.conf > /tmp/ntp_conf \
&& cat /tmp/ntp_conf > /etc/systemd/timesyncd.conf \
&& rm /tmp/ntp_conf && systemctl restart systemd-timesyncd.service

这在/tmp中使用了一个临时文件,因为目录的其余部分是只读的,这阻止了sed -i的工作。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/795139

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档