Q. How do I setup Ubuntu Linux system time using Network Time Protocol (NTP)? Do I need to install ntp server?
A. No you don't have to install NTP server. All you have to do is install simple client called ntpdate. ntpdate sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the server arguments to determine the correct time. It must be run as root on the local host.
A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of ntpdate depends on the number of servers, the number of polls each time it is run and the interval between runs.
Please note that ntpdate will decline to set the date if an NTP server daemon (ntpd) is running on the same host. When running ntpdate on a regular basis from cron as an alternative to running a daemon, doing so once every hour or two will result in precise enough timekeeping to avoid stepping the clock.
Install ntpdate client
$ sudo apt-get install ntpdate
ntpdate will automatically run when your network interface get activated by system (i.e. while booting Ubuntu Linux sever/desktop system) . Ubuntu Linux stores script at /etc/network/if-up.d/ntpdate location.
If you wish to just run script again just type command:
$ sudo /etc/network/if-up.d/ntpdate
$ sudo ntpdate pool.ntp.org
Install as cronjob
To avoid stepping the clock you must run ntpdate every 1 or 2 hours using cronjob:
Now add hourly job:
Save and close the file.Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?