How to Install and Use Chrony in Linux?
Last Updated :
05 Oct, 2021
chrony is a flexible Network Time Protocol implementation (NTP). It can sync the system clock with NTP servers, reference clocks (such as a GPS receiver), and manual input via wristwatch and keyboard. It can also act as an NTPv4 (RFC 5905) server and peer, allowing other computers on the network to receive timely updates.
A local server must use an NTP client to get the correct time from a remote NTP server. One such customer is Chrony. Chrony is an excellent option for this reason because it is designed to operate in a variety of situations, including unreliable and/or highly congested network connections, as well as other adverse conditions. At boot time, Chrony synchronizes the computer's internal clock with higher Stratum NTP servers, a reference clock, or the computer's real-time clock. Using a wristwatch and a keyboard, it can also be manually synchronized with the input. This is not the most reliable form of synchronization, and it is strongly discouraged.
On a LAN, the precision between two synchronized machines is usually within a few milliseconds. Chrony is divided into two systems: chronyc and chronyd.
- Chronyc is a command-line interface for monitoring and tweaking chronyd's output.
- Chronyd is a background-running daemon that starts and activates the chrony NTP service and tracks the time and status of the time-server.
The chrony.conf file specifies the time NTP server that chronyd tracks. The primary feature of the Chronyd system is to obtain accurate time from one of the major NTP server sources. If the server time is off, chronyd will adjust the device clock to compensate.
Chrony includes two programs:
- chronyd — daemon that can be started at boot time
- chronyc — command-line interface for chrony
How to Install Chrony in Linux:
Chrony may be installed by default on certain devices. And if the kit is missing, it is simple to install. Using the command below, use your default package manager utility on your respective Linux distributions.
# yum -y install chrony [On CentOS/RHEL]
# apt install chrony [On Debian/Ubuntu]
# dnf -y install chrony [On Fedora 22+]
installing chrony
To check the status of chronyd use the following command:
# systemctl status chronyd [On SystemD]
# /etc/init.d/chronyd status [On Init]
Enable chrony daemon upon boot with the following command:
- Residual freq — residual frequency indicated the difference between the measurements from the reference source and the frequency currently being used.
- Skew — estimated error bound of the frequency.
- Root delay — Total of the network path delays to the stratum computer, from which the computer is being synced.
- Leap status — this is the leap status that can have one of the following values – normal, insert second, delete second, or not synchronized.
# systemctl enable chronyd [On SystemD]
# chkconfig --add chronyd [On Init]
To Check Chrony Synchronization in Linux:
We'll use chrony's command-line software, chronyc, to see whether it's actually synchronized. It has a monitoring feature that will provide useful details.
# chronyc tracking
result of Check Chrony Synchronization
The listed files provide the following information:-
- Residual freq — Residual frequency indicated the difference between the measurements from the reference source and the frequency currently being used.
- Skew — Estimated error bound of the frequency.
- Root delay — Total of the network path delays to the stratum computer, from which the computer is being synced.
- Leap status — This is the leap status which can have one of the following values – normal, insert second, delete second, or not synchronized.
- Reference ID — The reference ID and name to which the computer is currently synced.
- Stratum — Number of hops to a computer with an attached reference clock.
- Ref time — This is the UTC time at which the last measurement from the reference source was made.
- System time — Delay of system clock from the synchronized server.
- Last offset — Estimated offset of the last clock update.
- RMS offset — Long-term average of the offset value.
- Frequency — This is the rate by which the system’s clock would be wrong if chronyd is not correcting it. It is provided in ppm (parts per million).
To check information about chrony’s sources:
# chronyc sources
Check Chrony Sources
Configure Chrony in Linux:
The configuration file of chrony is located at /etc/chrony.conf or /etc/chrony/chrony.conf and the sample configuration file may look something like this:
The above configuration provides the following information:
- Server — this directive used to describe an NTP server to sync from.
- stratumweight — how much distance should be added per stratum to the sync source. The default value is 0.0001.
- Driftfile — location and name of the file containing drift data.
- Makestep — this directive causes chrony to gradually correct any time offset by speeding or slowing down the clock as required.
- logdir — path to chrony’s log file.
If you want to step the system clock immediately and ignoring any adjustments currently being in progress:
# chronyc makestep
If you decide to stop chrony, you can use the following commands:
# systemctl stop chrony [On SystemD]
# /etc/init.d/chronyd stop [On Init]
This was a demonstration of the chrony utility and how to use it on a Linux system.
Similar Reads
How to Install Chkrootkit Tool in Kali Linux ?
The chkrootkit security scanner is a popular security tool that allows administrators to check the local system for evidence of a rootkit infection. A rootkit is a malicious application that may get access to a computer system without the user's knowledge. This implies that the rootkit may execute f
3 min read
How to Install and Run curlie Command on Linux?
Curl has been replaced by the more recent Curlie command, which provides a better command-line web request experience. This article will lead you through the installation process and show you how to use Curlie efficiently if you want to install it on Linux. Installing Linux curlie is simple, regardl
4 min read
How to Install Chromium Web Browser on Linux
Google launched and manages Chromium, an open-source, multi-platform web browser. Chromium is a web browser that is fast, stable, and secure. Google's Chromium browser is an open-source project. Google Chrome, Microsoft Edge, Opera, and many web browsers are all based on the Chromium source code. bu
2 min read
How to install Kloxo-MR in Linux
Kloxo-MR is a free web hosting panel available for Linux distributions. The name of the Lxadmin earlier knew it. But in 2017, The Lxadmin name was changed to the name Kloxo-MR. As there was some issue with the name. And also, there was a massive response from the user to change the application's nam
7 min read
How to install Gnome-Calendar in Ubuntu
This package provides the "calendar" application, which displays future relevant dates on a variety of calendars and is widely seen on BSD-style systems. A calendar app is first and foremost a scheduling tool. It allows you to create blocks on a calendar to plan out your day. A calendar app may be u
2 min read
How to Install Scipy In Python on Linux?
In this article, we are going to see how to install Scipy in Python on Linux, SciPy is a python library that is useful in solving many mathematical equations and algorithms, it is a free and open-source Python library built on top of the popular NumPy library. To install Scipy on Linux: There are ge
2 min read
How to Install cx_oracle in Python on Linux?
The cx_oracle package is used to connect with the Oracle database using python. In this, article, we will look into the process of installing the cx_oracle package on Linux. Pre-requisites: The only thing that you need for installing Numpy on Windows are: PythonPIP or Conda (Depending upon the user
2 min read
How to Install PHP intl extension in Ubuntu?
The Internationalisation (Intl) extension is a wrapper for the ICU library, a collection of C/C++ and Java libraries that provide Unicode and Globalisation support for software applications. It tends to closely follow ICU APIs so that people having experience working with ICU in either C/C++ or Java
2 min read
How to Change Time in Kali Linux
Kali Linux is a popular Debian-based Linux distribution used for pen-testing and ethical hacking. It is developed and maintained by an American cybersecurity firm, Offensive Security. Kali Linux comes pre-installed with various tools and software required for penetration testing and ethical hacking,
4 min read
How to Install Astropy Python Library on Linux?
Astropy is an open-source library written purely in Python, specifically designed for use in astronomy and astrophysics. Anyone can develop astronomy software with Astropy Astronomy Tools. Astropy library is a cross-platform library for various operating systems such as Windows, Linux, and macOS. In
2 min read