How to install Network Time Sync (NTP) with Chrony on Ubuntu 20

2021-09-01 By Aaron 5711 Views linux ubuntu ntp chrony time zone
7 reviews

The NTP (Network Time Protocol) is an Internet protocol that is used to synchronize the time on your system with a centralized Network Time Protocol server. It also analyses the timestamp values including the frequency of errors and the stability. On the other hand, Chrony is a flexible implementation of the Network Time Protocol (NTP).


This guide will help you to install and configure Chrony on Ubuntu 20.


  1. List the available time zones and then choose your preference.

    # timedatectl list-timezones
    

    ntpchrony1

  2. The below command help to set the server time zone. For example, change Asia/Hong_Kong to your time zone.

    # timedatectl set-timezone Asia/Hong_Kong
    

    ntpchrony2

  3. Update the package information index by executing the below command.

    # apt update
    

    ntpchrony3

  4. Start to install chrony with the below command.

    # apt install chrony -y
    

    ntpchrony4

  5. Start the Chrony service and check the status of the service.

    # systemctl start chronyd
    
    # systemctl status chronyd
    

    ntpchrony5

  6. Execute the below command to check the number of connected servers and peers.

    # chronyc activity
    

    ntpchrony6

  7. Show the statistics for each server.

    # chronyc sourcestats -v
    

    ntpchrony7

  8. Use the following command vi /etc/chrony/chrony.conf to edit the configuration file and add the below code to the end of the file and then Save & Exit.

    # server 123.123.123.123
    

    NOTE: Replace the IP address with your server IP address

    ntpchrony8

  9. Synchronize the servers and restart the Chrony service.

    # timedatectl set-ntp true
    
    # systemctl restart chronyd
    

    ntpchrony9

  10. Run the below command to check the list of clients added.

    # chronyc clients
    

    ntpchrony10

  11. Check the Chrony sources now.

    # chronyc sources
    

    ntpchrony11

  12. Execute the below command to check whether the server chrony is tracking with its performance metrics.

    # chronyc tracking
    

    ntpchrony12


Related Tutorial

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.