首先,我通过ntp安装了sudo apt-get install ntp包。
我访问/etc/ntp.conf,根据国家将服务器更改为几个本地服务器,然后使用sudo systemctl restart ntp保存并重新启动服务器,然后使用sudo systemctl status ntp检查状态,并显示正在运行的状态。
我还做了ntpq -p,给出了以下结果,我认为这意味着客户机正在运行:
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp.ubuntu.com .POOL. 16 p - 64 0 0.000 0.000 0.000
*time-a-g.nist.g .NIST. 1 u - 64 77 11.567 -7.287 7.636
-174.138.107.37 46.243.26.34 2 u 63 64 37 84.975 0.159 4.474
-ns3.weiszhostin 128.138.141.172 2 u 1 64 77 69.844 -11.884 6.043
+li290-38.member 128.138.141.172 2 u 65 64 37 43.448 -3.202 6.023
+pugot.canonical 145.238.203.14 2 u 61 64 37 79.540 -5.833 4.040
+alphyn.canonica 132.246.11.231 2 u 4 64 77 11.714 -5.017 7.244
+chilipepper.can 145.238.203.14 2 u 61 64 37 78.136 -4.269 4.769
+golem.canonical 145.238.203.14 2 u 55 64 37 81.139 -3.766 4.748但是,我似乎无法让守护进程运行。我在做sudo systemctl status ntpd时发现了这一点,然后给出了以下结果:
ntpd.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)我以为它不是一开始就开始的,所以我做了sudo systemctl start ntpd,但是它给出了:
Failed to start ntpd.service: Unit ntpd.service not found.
当我发现有什么严重的问题时,我检查了ls -l /etc/init.d,发现只有ntp在列表中,找不到ntpd。我也试图重新安装ntp,但这并没有帮助。
有什么想法吗?非常感谢!
发布于 2020-09-19 16:51:44
sudo apt-get install -y ntp
sudo timedatectl set-ntp on
sudo service ntp restart
sudo service ntp status | cat发布于 2020-02-21 13:01:34
sudo systemctl unmask ntp.service
sudo systemctl start ntp.service
sudo systemctl enable ntp.service哇哦!
发布于 2020-06-04 10:14:15
NTP是一个对等协议,因此ntpd守护进程同时充当服务器和客户端。
在Ubuntu上,服务名为ntp,尽管守护进程名为ntpd。如果您查看sudo systemctl status ntp的输出,您将看到它实际上运行ntpd:
CGroup: /system.slice/ntp.service
└─1201 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 110:118所以一切都很好。systemctl显示ntpd守护进程正在运行,ntpq -p显示它正在成功地同步到其他服务器。
https://askubuntu.com/questions/1009729
复制相似问题