27

Install an NTP Server with Chrony on Ubuntu 20.04

 2 years ago
source link: https://www.vultr.com/docs/install-an-ntp-server-with-chrony-on-ubuntu-20-04
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
<?xml encoding="utf-8" ??>

Introduction

Chrony is a Network Time Protocol (NTP) client. An NTP server allows all devices on a network to synchronize their time. This article explains how to install and configure Chrony on Ubuntu 20.04.

Prerequisites

Install and Configure Chrony

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

    $ sudo timedatectl list-timezones
    
  2. Set the server time zone. For example, change Africa/Nairobi to your time zone.

    $ sudo timedatectl set-timezone Africa/Nairobi
    
  3. Update the system packages.

    $ sudo apt update
    
  4. Install Chrony.

    $ sudo apt install chrony -y
    
  5. Start the Chrony service.

    $ sudo systemctl start chronyd
    
  6. Check the status of the service.

    $ sudo systemctl status chronyd
    
  7. Check the number of connected servers and peers.

    $ chronyc activity
    
  8. Show the statistics for each server.

    $ chronyc sourcestats -v
    
  9. Edit the Chrony configuration file.

    $ sudo nano /etc/chrony/chrony.conf
    
  10. Add the following code to the end of the file. Change 192.168.2.12 to your server's IP address. You can add other servers by specifying their IP addresses.

    server 192.168.2.12

  11. Save and exit the file.

  12. Synchronize the servers.

    $ sudo timedatectl set-ntp true
    
  13. Restart the Chrony service.

    $ sudo systemctl restart chronyd
    
  14. Check the list of clients added.

    $ sudo chronyc clients
    
  15. Check the Chrony sources.

    $ chronyc sources
    
  16. Check the server chrony is tracking with its performance metrics.

    $ chronyc tracking
    

More Information

See the chrony FAQ for more information.

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK