How to install NTP Server and Client on Ubuntu

This guide takes you through the steps needed to install and configure the NTP server as well as the client on a Ubuntu PC.

NTP (Network Time Protocol) is a networking protocol responsible for synchronizing the clocks of computers over a network. It has both the server and the client programs residing on the networked systems. Each server must have an NTP Client software to synchronize its clock to the network time server, and in most cases, it is by default resides in the device’s operating system.

Significant Features of NTP Server

Here are some basic features of NTP:

  • NTP requires a reference clock that gives a standard time as all system clocks have some correct time, but they might have little bit variation, but NTP computes the right time by using some standard calculations.
  • Depends on UTC (Universal Time Clock) as a reference time
  • NTP is a fault-tolerant protocol that will synchronize its time by resolving several time sources and minimizing accumulated error. It will discard any temporary or permanent inaccurate time source.
  • It is highly scalable; you can add as many time sources as you can as each node will communicate in bidirectional or unidirectional and will transmit time by forming a tree-like structure with reference clock is on top.
  • It is highly accurate as it chooses the best among the available time sources with a margin of error less than a nanosecond.
  • It even works when the network is temporarily down as it calculates time from past to estimate current time and margin of error.

In this guide, we will show you how to install the NTP server, and it’s client program on Ubuntu.


  • A running Ubuntu Server
  • A user (root or non-root) with sudo privileges

Installing NTP Server on Ubuntu

First of all, we will show you step by step procedure to install the NTP Server on Ubuntu.

Step 1: Updating System Repository

By default, the NTP Server package is available in Ubuntu’s default package repository, but before installing it, let us update the package repository by using the below command.

$ sudo apt update -y

Step 2: Install NTP Server

Now you can install NTP Server using below command

$ sudo apt install ntp

NTP Server Install command
NTP Server Install command

Type “Y” on confirmation prompt and hit Enter to continue installing process.

Step 3: Confirm NTP Server Installation

Now check your NTP Server installation status using below command

$ sntp --version

NTP Server installation verification
NTP Server installation verification

Step 4: Configure NTP Server

After successful installation, now its time to configure it so that it can synchronize its time from public NTP Server. To do that, you need to edit the ntp.conf file using the below command.

$ sudo nano /etc/ntp.conf

Configure NTP Server pool servers
Configure NTP Server pool server

Now you need to replace the below lines

pool iburst
pool iburst
pool iburst
pool iburst

with your desired NTP pool server for this tutorial I am using Europe. You can see list of NTP Pool Server here

pool iburst
pool iburst
pool iburst
pool iburst

After replacing the above line, please save and exit the configuration file. Now to apply these settings, we need to restart NTP service using below command

$ sudo systemctl restart ntp

Now after the restart, you can check NTP Service status using below command

$ sudo systemctl status ntp

NTP Service status
NTP Service status

Installing NTP Client on Ubuntu

In this section, we will show you step by step procedure to install NTP Client so that we can sync with our NTP Server.

Step 1: Install Ntpdate

Ntpdate is a program that allows the system to synchronize its time and date by connecting to an NTP server. so we will install Ntpdate using below command

$ sudo apt install ntpdate

ntpdate installation
ntpdate installation

Step 2: Add NTP Server IP in Host File

NTP Client needs to resolve the NTP server by hostname, so for that, you need to add the NTP server’s IP address and hostname in the /etc/hosts file.

To edit /etc/hosts file using below command

$ sudo nano /etc/hosts

Now add your server IP with the hostname in /etc/hosts file like this

setting up ntp server ip in host file
setting up NTP server IP in the host file

Step 3: Verify Client Time Sync

Now we will test our client system if it is in sync with the NTP server’s time, run the command.

$ sudo ntpdate ntp-server-host


Step 4: Installing NTP Client

Next, We need to install an NTP service on the client system. To achieve this, use the below command.

$ sudo apt install ntp

NTP Client installation
NTP Client installation

Step 5: Configuring NTP Client

The objective in this step is to use the NTP server earlier configured to act as our NTP server. For this to happen, we need to edit the /etc/ntp.conf file.

$ sudo nano /etc/ntp.conf

will add our server setting like this

verifying NTP Server with Client
verifying NTP Server with Client

Save and exit the configuration file.

For the changes to come into effect, restart the NTP service using below command

$ sudo systemctl restart ntp

Step 6: Verifying NPT Time Synchronization Queue

Now client and NTP server insync, you can view the sync details by executing the command.

$ ntpq -p

the output will be like

Time Synchronization Queue
Time Synchronization Queue

At this point, you have successfully configured the NTP server on Ubuntu and also set NTP client to be synced from NTP Server.

Habib Ahmed
He is a professional writer with more than seven years of experience in the field. He also enjoys technical writing/ manuals, white papers, and scientific presentations.


Please enter your comment!
Please enter your name here





Buyers who wish to go for a machine that is based on Linux often show interest in Chromebooks due to the form factor and extended battery life capabilities. Although ChromeOS power these machines, users can still miss out on a more genuine Linux experience. For those who happen to agree, the new Lemur Pro by System76 might get some heads turning.
Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.

13 ways to use the copy command in Linux (with examples)

Being a Linux user, copying files and directories is one of the everyday tasks that you have to carry out. It can be copying a file to make a backup or copy it to another partition, directory, or external storage drive.

6 ways to find out your Linux file system type

Any Operating system in the market whether its Windows, Linux, Unix, macOS, and any other, must be able to access and manage files and data on storage devices.

How to dual-boot Ubuntu and Fedora on your PC

Every Linux distribution has its capabilities and preferences as per the user requirements. That brings forth the need to run different distros on one laptop. For example, a CyberSecurity enthusiast might prefer to use Ubuntu for development and Kali Linux for penetration testing.

10 Reasons to use Cinnamon as your Desktop Environment

With the release of Gnome 3 in 2011, there was quite a mixed reaction from users and developers. Most of them preferred the original Gnome that got forked, and one of those forks was Cinnamon. Since the release of Cinnamon 2.0, Cinnamon has evolved to become a desktop environment by itself.