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 Server
The first step is to install NTP software, The software package in Debian called ‘NTP‘.
apt-get install ntp
Make sure that the correct time zone is configured on the server with below command.
date
If you wish to change the timezone go to the following path to see available time zones.
ls -la /usr/share/zoneinfo/
As it appears some of the time zones are available in the folder but the others are in the sub-directories. For example, we are going to change the time zone to Los Angeles.
mv /etc/localtime /etc/localtime.back
ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Now your system is ready to synchronize time, you need to save the configurations and restart the NTP.
service ntp restart
You can simply monitor NTP by “ntpq”:
ntpq -r