Maintaining an accurate system clock is essential for many server operations. Hardware clocks can drift over time, causing discrepancies that might affect scheduling, logging, and security operations. In this guide, you’ll learn how to synchronize time on Linux systems using network peers and the Chrony daemon. Chrony is the default time synchronization tool in modern CentOS systems. It regularly updates the system clock by retrieving time data from trusted internet servers. For example, even a small drift—where your server shows 6 seconds past midnight while the actual time is 5 seconds—can result in noticeable inaccuracies over prolonged periods.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Verify Chrony Service
To confirm that Chrony is running correctly, execute the following command:Checking System Time Settings
You can inspect the current system time configuration with thetimedatectl command:
An unsynchronized clock can lead to issues in log management and automated tasks. Always verify that the system time is accurate.
Configuring Time Zone
Before setting up Chrony, it’s important to configure the correct time zone for your server. For instance, to set your server’s time zone to New York time, use:Installing and Enabling Chrony
If Chrony is not already installed on your system, follow these steps:-
Install Chrony using the package manager:
-
Start the Chrony service:
-
Enable Chrony to start automatically at boot:
Verifying Time Synchronization
After installing Chrony, check again usingtimedatectl:
For additional details on troubleshooting time synchronization issues, please refer to the Chrony Troubleshooting Guide.