Synchronize date and time: Difference between revisions

From WickyWiki
Created page with "Category:Ubuntu Category:Ubuntu System Category:201708 Source: * https://askubuntu.com/questions/228/how-to-set-ubuntu-to-synchronize-my-clock-with-a-time-server..."
 
mNo edit summary
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
[[Category:Ubuntu System]]
[[Category:Ubuntu System]]
[[Category:201708]]
[[Category:201708]]
= timedatectl =
<syntaxhighlight lang=bash>
#check state and settings
timedatectl
#turn sync on, it could take some minutes to sync
sudo timedatectl set-ntp true
</syntaxhighlight>
= Ubuntu upgrades to 14.04 =


Source:
Source:
* https://askubuntu.com/questions/228/how-to-set-ubuntu-to-synchronize-my-clock-with-a-time-server
* https://help.ubuntu.com/lts/serverguide/NTP.html
 
An Ubuntu upgrade keeps the ntpdate configuration intact and timedatectl is turned on but not synchronizing. Since ntpdate is depreciated you can manually uninstall it and replace it with ntp.
 
<syntaxhighlight lang=bash>
#uninstall ntpdate
sudo apt-get autoremove ntpdate
 
#install ntp daemon (ntpd)
sudo apt install ntp
</syntaxhighlight>
 
Force update now:
 
<syntaxhighlight lang=bash>
sudo service ntp stop
 
#correct the time regardless of the offset (g) and exit immediately (q)
sudo ntpd -gq
 
sudo service ntp start
</syntaxhighlight>
 
Check state and settings:


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
sudo ntpdate pool.ntp.org
timedatectl
</syntaxhighlight>
</syntaxhighlight>


See also
See also
* https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-16-04
* https://www.digitalocean.com/community/tutorials/how-to-set-up-time-synchronization-on-ubuntu-16-04
= ntpdate (depreciated) =
Source:
* https://askubuntu.com/questions/228/how-to-set-ubuntu-to-synchronize-my-clock-with-a-time-server


<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
sudo timedatectl set-ntp on
sudo ntpdate pool.ntp.org
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 20:21, 18 August 2017


timedatectl

#check state and settings
timedatectl

#turn sync on, it could take some minutes to sync
sudo timedatectl set-ntp true

Ubuntu upgrades to 14.04

Source:

An Ubuntu upgrade keeps the ntpdate configuration intact and timedatectl is turned on but not synchronizing. Since ntpdate is depreciated you can manually uninstall it and replace it with ntp.

#uninstall ntpdate
sudo apt-get autoremove ntpdate

#install ntp daemon (ntpd)
sudo apt install ntp

Force update now:

sudo service ntp stop

#correct the time regardless of the offset (g) and exit immediately (q)
sudo ntpd -gq

sudo service ntp start

Check state and settings:

timedatectl

See also

ntpdate (depreciated)

Source:

sudo ntpdate pool.ntp.org