Install NTPD on Debian/Ubuntu to Synchronise Time

NTP Server Install on Debian or Ubuntu:

Q: How do I make my dedicated servers synchronise with Internet Standard time by installing NTP ( Network Time Protocol)?

A: NTPD is a daemon which can be installed to run during startup and it continues to synchronise with time servers on the Inernet via NTP on UDP port 123. NTP server can be installed with very few steps on Debian and Ubuntu.

Please see the instructions below to see how NTP server can be installed on Linux OS:
Login as root or use sudo in front of all commands:

apt-get install ntp

Following the execution of that command it will prompt you with:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libopts25
Suggested packages:
  ntp-doc
The following NEW packages will be installed:
  libopts25 ntp
0 upgraded, 2 newly installed, 0 to remove and 60 not upgraded.
Need to get 635 kB of archives.
After this operation, 1,460 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y

Type “Y” and Enter to continue with the installation.

Following that entry the package installer will continue to finish the installation. You will see see the following status message if the install of NTP server was successful:

[ ok ] Starting NTP server: ntpd.
Configuring NTP Server for Synchronisation:

Now it’s time to configure our NTP Server from it’s default configuration:

I am using VI editor but feel free to use any other editor that is available on your Debian/Ubuntu system to edit the NTP configuration file:

vi /etc/ntp.conf

The default NTP configuration file looks like this:

server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst

You can change that list of course to suit your needs. If you have UK servers you may wish to sync with a local NTP server to avoid latency. In those instance I would recommend changing the NTP server pools to be something like:

server 0.uk.pool.ntp.org
server 1.uk.pool.ntp.org
server 2.uk.pool.ntp.org
server 3.uk.pool.ntp.org

Once you have updated the NTP configuration file the service requires a restart to apply the changes. You can do that by executing the following Linux command:

/etc/init.d/ntp restart

Result should be:

[ ok ] Stopping NTP server: ntpd.
[ ok ] Starting NTP server: ntpd.

Troubleshooting NTPD and Time Sync with peers:

ntpq

Then enter peer to show the list of active peers. This table shows information about NTP delay and time offset etc so you can troubleshoot any NTP sync issues with time.

ntpq> peer
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*85.12.35.12     193.79.237.14    2 u   63   64    7    5.567   18.913   6.391
-hades.wf-hostin 43.77.130.254    2 u   61   64    7   16.334   30.708   2.969
+mm-12-151-57-86 93.84.115.2      3 u   61   64    7   58.053   22.831   2.886
+net1.uni-paderb 131.234.137.64   2 u   58   64    7   24.107   24.005   2.899

You can also try using the following command to see a quick list of peers and their sync status:

ntpq -p

Install NTPD on Debian/Ubuntu to Synchronise Time in order to keep systems in order.

Add a Comment