Install an NTP Server with Chrony on Ubuntu 20.04
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
- Deploy a fully updated Ubuntu 20.04 LTS server at Vultr.
- Create a non-root user with sudo access.
Install and Configure Chrony
List the available time zones and choose your preference.
$ sudo timedatectl list-timezones
Set the server time zone. For example, change
Africa/Nairobi
to your time zone.$ sudo timedatectl set-timezone Africa/Nairobi
Update the system packages.
$ sudo apt update
Install Chrony.
$ sudo apt install chrony -y
Start the Chrony service.
$ sudo systemctl start chronyd
Check the status of the service.
$ sudo systemctl status chronyd
Check the number of connected servers and peers.
$ chronyc activity
Show the statistics for each server.
$ chronyc sourcestats -v
Edit the Chrony configuration file.
$ sudo nano /etc/chrony/chrony.conf
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
Save and exit the file.
Synchronize the servers.
$ sudo timedatectl set-ntp true
Restart the Chrony service.
$ sudo systemctl restart chronyd
Check the list of clients added.
$ sudo chronyc clients
Check the Chrony sources.
$ chronyc sources
Check the server chrony is tracking with its performance metrics.
$ chronyc tracking
More Information
See the chrony FAQ for more information.