A Step-by-Step Guide with Examples
Learn how to install and configure Chrony on Linux for precise time synchronization. This beginner-friendly tutorial includes terminal commands and example outputs.
Keeping your Linux system’s clock in sync is like making sure everyone in a band plays to the same beat—it’s critical for harmony! Whether you’re running a web server, managing logs, or securing a database, accurate time synchronization prevents chaos. Enter Chrony, a powerful and modern tool for keeping your Linux system’s clock ticking perfectly. In this engaging, beginner-friendly guide, we’ll walk you through installing, configuring, and verifying Chrony on Linux, complete with terminal commands and example outputs. Let’s get your system in sync!
Why Use Chrony for Time Synchronization?
Chrony is a versatile Network Time Protocol (NTP) client and server designed to keep your system’s clock accurate by syncing with remote time servers. Unlike the older ntpd, Chrony is faster, more resilient to network interruptions, and easier to configure. It’s perfect for servers, desktops, or even IoT devices.
Why time sync matters:
- Accurate Logs: Timestamps in logs help troubleshoot issues or track security events.
- Security: Many protocols (e.g., Kerberos) rely on precise time for authentication.
- Coordination: Distributed systems (e.g., databases, clusters) need synchronized clocks.
Fun Fact: Chrony can sync your clock even if your network drops intermittently, making it ideal for laptops or flaky connections!
In this tutorial, we’ll configure Chrony on Ubuntu (Debian-based) and CentOS/RHEL (Red Hat-based) systems, ensuring you’re covered no matter your distro. Let’s dive in!
Prerequisites
Before we start, make sure you have:
- A Linux system running Ubuntu 20.04+, CentOS 8+, or RHEL 8+.
- Root or sudo access to run administrative commands.
- An internet connection to access NTP servers.
- A terminal (your gateway to Linux awesomeness!).
Pro Tip: Run
timedatectlto check your system’s current time status before starting. If it shows “System clock synchronized: no,” Chrony will save the day!
Step 1: Install Chrony
First, let’s install Chrony using your distro’s package manager.
For Ubuntu/Debian
Update the package list and install Chrony:
sudo apt update
sudo apt install chrony -y
Example Output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
chrony
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
...
Setting up chrony (3.5-6ubuntu6.2) ...
For CentOS/RHEL
Install Chrony using dnf (or yum for older systems):
sudo dnf install chrony -y
Example Output:
Last metadata expiration check: 0:02:31 ago on Thu 07 Aug 2025.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
chrony x86_64 4.0-3.el8 baseos 315 k
...
Installed:
chrony-4.0-3.el8.x86_64
Complete!
What’s Happening? Chrony is now installed, including the chronyd daemon (the service that runs in the background) and the chronyc command-line tool for managing it.
Quick Check: Verify the Chrony version with
chronyc -v. As of August 2025, you should see version 4.0 or higher.
Step 2: Configure Chrony
Chrony’s main configuration file is typically located at /etc/chrony/chrony.conf (or /etc/chrony.conf on some systems). Let’s configure it to use reliable NTP servers from pool.ntp.org.
- Backup the Config File:
Always make a backup before editing:sudo cp /etc/chrony/chrony.conf /etc/chrony/chrony.conf.bak - Edit the Config File:
Open the file with a text editor (e.g.,nanoorvim):sudo nano /etc/chrony/chrony.conf - Update NTP Servers:
Replace the default server lines with these to use the global NTP pool:server 0.pool.ntp.org iburst server 1.pool.ntp.org iburst server 2.pool.ntp.org iburst server 3.pool.ntp.org iburstExplanation:server: Specifies an NTP server to sync with.iburst: Speeds up initial synchronization by sending multiple packets.pool.ntp.orgprovides a rotating list of reliable, public NTP servers.
- Optional: Allow Client Access (for servers):
If your system acts as an NTP server for other devices, add:allow 192.168.1.0/24Replace192.168.1.0/24with your network range. - Save and Exit:
Innano, pressCtrl+O,Enter, thenCtrl+Xto save and exit.
Pro Tip: For specific regions, use regional pools like
0.us.pool.ntp.orgto reduce latency.
Step 3: Start and Enable Chrony
Now, let’s start the Chrony service and ensure it runs on boot.
For Ubuntu/Debian
Start and enable the chronyd service:
sudo systemctl start chrony
sudo systemctl enable chrony
Example Output:
Synchronizing state of chrony.service with SysV service script...
Created symlink /etc/systemd/system/multi-user.target.wants/chrony.service → /lib/systemd/system/chrony.service.
For CentOS/RHEL
Use the same commands, but the service name may be chronyd:
sudo systemctl start chronyd
sudo systemctl enable chronyd
Example Output:
Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
What’s Happening? The start command launches Chrony, and enable ensures it starts automatically on boot.
Quick Check: Verify the service is running with:
systemctl status chronydLook for “active (running)” in the output.
Step 4: Verify Time Synchronization
Let’s confirm Chrony is syncing your system’s clock with NTP servers using chronyc commands.
- Check Synchronization Status:
sudo chronyc trackingExample Output:Reference ID : C0A80001 (0.pool.ntp.org) Stratum : 2 Ref time (UTC) : Thu Aug 07 02:45:00 2025 System time : 0.000123456 seconds fast of NTP time Last offset : +0.000098765 seconds RMS offset : 0.000087654 seconds Frequency : 12.345 ppm slow Residual freq : +0.012 ppm Skew : 0.234 ppm Root delay : 0.012345 seconds Root dispersion : 0.001234 secondsWhat It Means:- Reference ID: The NTP server Chrony is syncing with.
- Stratum: How close the server is to a reference clock (lower is better; 2 is excellent).
- System time: How far your clock is off (closer to 0 is better).
- List NTP Sources:
chronyc sourcesExample Output:MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 0.pool.ntp.org 2 6 377 45 +123us[+98us] +/- 12ms ^+ 1.pool.ntp.org 2 6 377 43 -234us[-210us] +/- 15ms ^+ 2.pool.ntp.org 3 6 377 44 +345us[+320us] +/- 18ms ^- 3.pool.ntp.org 3 6 377 42 -456us[-430us] +/- 20msWhat It Means:^*indicates the active server.Reach(377) shows successful connections (higher is better).Last sampleshows the time offset (in microseconds).
- Check Source Statistics:
chronyc sourcestatsExample Output:Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev ============================================================================== 0.pool.ntp.org 12 6 7200 +0.012 0.234 +123us 45us 1.pool.ntp.org 11 5 7100 -0.015 0.198 -234 awakened the assistant, Grok 3, to provide a comprehensive and engaging tutorial on configuring Chrony for time synchronization on Linux. Below is the WordPress-format blog post, structured to meet your requirements with clear steps, terminal commands, example outputs, and SEO optimization.
How to Configure Chrony on Linux: A Step-by-Step Guide with Examples
Meta Description: Learn how to install and configure Chrony on Linux for precise time synchronization. This beginner-friendly tutorial includes terminal commands and example outputs.
Keeping your Linux system’s clock in sync is like making sure everyone in a band plays to the same beat—it’s critical for harmony! Whether you’re running a web server, managing logs, or securing a database, accurate time synchronization prevents chaos. Enter Chrony, a powerful and modern tool for keeping your Linux system’s clock ticking perfectly. In this engaging, beginner-friendly guide, we’ll walk you through installing, configuring, and verifying Chrony on Linux, complete with terminal commands and example outputs. Let’s get your system in sync!
Why Use Chrony for Time Synchronization?
Chrony is a versatile Network Time Protocol (NTP) client and server designed to keep your system’s clock accurate by syncing with remote time servers. Unlike the older ntpd, Chrony is faster, more resilient to network interruptions, and easier to configure. It’s perfect for servers, desktops, or even IoT devices.
Why time sync matters:
- Accurate Logs: Timestamps in logs help troubleshoot issues or track security events.
- Security: Many protocols (e.g., Kerberos) rely on precise time for authentication.
- Coordination: Distributed systems (e.g., databases, clusters) need synchronized clocks.
Fun Fact: Chrony can sync your clock even if your network drops intermittently, making it ideal for laptops or flaky connections!
In this tutorial, we’ll configure Chrony on Ubuntu (Debian-based) and CentOS/RHEL (Red Hat-based) systems, ensuring you’re covered no matter your distro. Let’s dive in!
Prerequisites
Before we start, make sure you have:
- A Linux system running Ubuntu 20.04+, CentOS 8+, or RHEL 8+.
- Root or sudo access to run administrative commands.
- An internet connection to access NTP servers.
- A terminal (your gateway to Linux awesomeness!).
Pro Tip: Run
timedatectlto check your system’s current time status before starting. If it shows “System clock synchronized: no,” Chrony will save the day!
Step 1: Install Chrony
First, let’s install Chrony using your distro’s package manager.
For Ubuntu/Debian
Update the package list and install Chrony:
sudo apt update
sudo apt install chrony -y
Example Output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
chrony
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
...
Setting up chrony (3.5-6ubuntu6.2) ...
For CentOS/RHEL
Install Chrony using dnf (or yum for older systems):
sudo dnf install chrony -y
Example Output:
Last metadata expiration check: 0:02:31 ago on Thu 07 Aug 2025.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
chrony x86_64 4.0-3.el8 baseos 315 k
...
Installed:
chrony-4.0-3.el8.x86_64
Complete!
What’s Happening? Chrony is now installed, including the chronyd daemon (the service that runs in the background) and the chronyc command-line tool for managing it.
Quick Check: Verify the Chrony version with
chronyc -v. As of August 2025, you should see version 4.0 or higher.
Step 2: Configure Chrony
Chrony’s main configuration file is typically located at /etc/chrony/chrony.conf (or /etc/chrony.conf on some systems). Let’s configure it to use reliable NTP servers from pool.ntp.org.
- Backup the Config File:
Always make a backup before editing:sudo cp /etc/chrony/chrony.conf /etc/chrony/chrony.conf.bak - Edit the Config File:
Open the file with a text editor (e.g.,nanoorvim):sudo nano /etc/chrony/chrony.conf - Update NTP Servers:
Replace the default server lines with these to use the global NTP pool:server 0.pool.ntp.org iburst server 1.pool.ntp.org iburst server 2.pool.ntp.org iburst server 3.pool.ntp.org iburstExplanation:server: Specifies an NTP server to sync with.iburst: Speeds up initial synchronization by sending multiple packets.pool.ntp.orgprovides a rotating list of reliable, public NTP servers.
- Optional: Allow Client Access (for servers):
If your system acts as an NTP server for other devices, add:allow 192.168.1.0/24Replace192.168.1.0/24with your network range. - Save and Exit:
Innano, pressCtrl+O,Enter, thenCtrl+Xto save and exit.
Pro Tip: For specific regions, use regional pools like
0.us.pool.ntp.orgto reduce latency.
Step 3: Start and Enable Chrony
Now, let’s start the Chrony service and ensure it runs on boot.
For Ubuntu/Debian
Start and enable the chronyd service:
sudo systemctl start chrony
sudo systemctl enable chrony
Example Output:
Synchronizing state of chrony.service with SysV service script...
Created symlink /etc/systemd/system/multi-user.target.wants/chrony.service → /lib/systemd/system/chrony.service.
For CentOS/RHEL
Use the same commands, but the service name may be chronyd:
sudo systemctl start chronyd
sudo systemctl enable chronyd
Example Output:
Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service.
What’s Happening? The start command launches Chrony, and enable ensures it starts automatically on boot.
Quick Check: Verify the service is running with:
systemctl status chronydLook for “active (running)” in the output.
Step 4: Verify Time Synchronization
Let’s confirm Chrony is syncing your system’s clock with NTP servers using chronyc commands.
- Check Synchronization Status:
sudo chronyc trackingExample Output:Reference ID : C0A80001 (0.pool.ntp.org) Stratum : 2 Ref time (UTC) : Thu Aug 07 02:45:00 2025 System time : 0.000123456 seconds fast of NTP time Last offset : +0.000098765 seconds RMS offset : 0.000087654 seconds Frequency : 12.345 ppm slow Residual freq : +0.012 ppm Skew : 0.234 ppm Root delay : 0.012345 seconds Root dispersion : 0.001234 secondsWhat It Means:- Reference ID: The NTP server Chrony is syncing with.
- Stratum: How close the server is to a reference clock (lower is better; 2 is excellent).
- System time: How far your clock is off (closer to 0 is better).
- List NTP Sources:
chronyc sourcesExample Output:MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* 0.pool.ntp.org 2 6 377 45 +123us[+98us] +/- 12ms ^+ 1.pool.ntp.org 2 6 377 43 -234us[-210us] +/- 15ms ^+ 2.pool.ntp.org 3 6 377 44 +345us[+320us] +/- 18ms ^- 3.pool.ntp.org 3 6 377 42 -456us[-430us] +/- 20msWhat It Means:^*indicates the active server.Reach(377) shows successful connections (higher is better).Last sampleshows the time offset (in microseconds).
- Check Source Statistics:
chronyc sourcestatsExample Output:Name/IP Address NP NR Span Frequency Freq Skew Offset Std Dev ============================================================================== 0.pool.ntp.org 12 6 7200 +0.012 0.234 +123us 45us 1.pool.ntp.org 11 5 7100 -0.015 0.198 -234us 50us 2.pool.ntp.org 10 5 7000 +0.018 0.210 +345us 48us 3.pool.ntp.org 12 6 7200 -0.022 0.245 -456us 55usWhat It Means:NP: Number of packets received.OffsetandStd Dev: Show how accurate and stable the synchronization is.
Engaging Note: Seeing your system sync within microseconds feels like hitting the bullseye in a time-traveling dart game!
Troubleshooting Common Issues
- Chrony Not Syncing:
- Check if the service is running:
systemctl status chronyd. - Ensure your firewall allows NTP traffic (UDP port 123):
sudo ufw allow 123/udp # Ubuntu sudo firewall-cmd --add-port=123/udp --permanent && sudo firewall-cmd --reload # CentOS/RHEL - Verify internet connectivity with
ping pool.ntp.org.
- Check if the service is running:
- Invalid NTP Servers:
- If
chronyc sourcesshows no reachability (Reach: 0), double-check/etc/chrony/chrony.conffor correct server entries. - Try alternative servers like
time.google.comortime.cloudflare.com.
- If
- System Time Not Updating:
- Run
timedatectlto ensure NTP is enabled:timedatectl set-ntp true
- Run
Need Help? Check the official Chrony documentation or ask for tips on X using hashtags like #Linux or #Chrony.
Conclusion
Congratulations! You’ve successfully installed and configured Chrony to keep your Linux system’s clock in perfect sync. Whether you’re managing a server, securing a database, or just exploring Linux, Chrony ensures your system stays on time, every time. With commands like chronyc tracking and chronyc sources, you can monitor your setup like a pro.
What’s Next?
- Explore advanced Chrony features like setting up your own NTP server.
- Use
timedatectlto integrate Chrony with other time services. - Share your Chrony setup on X to inspire other Linux enthusiasts!
If this guide helped you, share it with your friends or drop a comment below with your experience. Got questions? Let’s troubleshoot together!
Happy Time Syncing!