NTP (Network Time Protocol) is a protocol which runs over port 123 UDP. NTP synchronize clients time and date with a master server.
This tutorial is about the client side configuration, but the server side configurations are not entirely different.
We are assuming that you have root permission, otherwise, you may start commands with “sudo”.
Install and configure NTP Daemon
apt-get install ntp
Make sure that the correct time zone is configured on the server with below command.
timedatectl
If you wish to change the timezone to get the list of all the available time zones, type:
timedatectl list-timezones
To set your time zone you can use command below: (e.g. Los Angeles)
timedatectl set-timezone America/Los_Angeles
Now you must active the NTPD service at boot:
systemctl start ntpd
To get a basic report you can use
date
And to get some information about the time synchronization process
ntpq -p
All of your NTP configurations are here:
/etc/ntp.conf