How to automatically set the correct time on the server once a day on Ubuntu and then set the correct timezone

How to set the correct timezone on the server

sudo dpkg-reconfigure tzdata

 

 

 

 

Remove the old NTP server

Previous versions of Ubuntu used another NTP server.

sudo apt autoremove ntp

 

 

 

How to automatically synchronize the time on the server with a NTP server

 

The following port must be open for outgoing traffic in the firewall:

UDP port: 123

 

 

Check current status:

date

 

 

Turn on NTP syncronisation:

sudo timedatectl set-ntp on

 

 

The current status of time and time configuration:

timedatectl status

 

 

Check the status more in detail via:

systemctl status systemd-timesyncd

 

 

Restart the service

sudo systemctl restart systemd-timesyncd.service