How to Install and Configure Chrony on Ubuntu 20.04
Keeping accurate time on a Linux server is not only about precision but also about stability, security and long term reliability. Every process on a server from log timestamps to SSL certificates and cron jobs depends on a properly synchronized clock. Without it even small timing errors can cause major problems in authentication backups or data replication. That is where Chrony proves its real value. It is a lightweight and intelligent NTP tool that performs faster and more accurately than the old ntpd service. I have personally tested Chrony on multiple Ubuntu based VPS servers and found it to be highly dependable even when the network connection is weak or unstable. Unlike other time synchronization tools, Chrony can recover from connection drops automatically and adjust itself in seconds. In this complete guide we will go step by step through how to install and configure Chrony on Ubuntu 20.04 and I will also share some real world notes on why it performs better than traditional time daemons.
Why Accurate Time Matters on a Server
Before we begin it is important to understand why accurate time is so critical in a server environment. Time synchronization affects almost everything a server does. When logs are not aligned in time, troubleshooting becomes almost impossible. SSL certificates and tokens may expire unexpectedly. Scheduled tasks might run at the wrong moment. Chrony ensures that all these elements stay in sync and that the system remains reliable even under heavy workloads.
Requirements Before You Begin
To install Chrony you need
1 A VPS or dedicated server running Ubuntu 20.04
2 Root or sudo privileges
3 A stable internet connection
Step 1 Update Your System
Always start by updating your system to avoid compatibility issues. Use these commands
sudo apt update
sudo apt upgrade -y
This ensures that Ubuntu uses the latest stable dependencies and libraries which makes the next steps smoother.
Step 2 Install Chrony
Once your system is updated install Chrony with
sudo apt install chrony -y
Chrony will now be added to your system and ready for configuration. It reacts to clock drift and latency very quickly which is why it performs so well on virtual machines and cloud environments.
Step 3 Configure Chrony
Next open the Chrony configuration file
sudo nano /etc/chrony/chrony.conf
Inside the file find the section that begins with the word pool and replace or uncomment your preferred NTP servers for example
pool 2.debian.pool.ntp.org iburst
pool 3.debian.pool.ntp.org iburst
If you manage servers in different regions it is smart to use NTP servers that are geographically close. This small choice reduces latency and improves synchronization accuracy.
Step 4 Enable Chrony on Startup
Make sure Chrony uses your configuration automatically when the system starts
sudo nano /etc/default/chrony
Then modify this line
NTPD_OPTS='-q -g -c /etc/chrony/chrony.conf'
Save and close the file.
Step 5 Start and Enable Chrony
Start the Chrony service and enable it to run every time the server boots
sudo systemctl start chronyd sudo systemctl enable chronyd
Check the service status with
sudo systemctl status chronyd
If everything is correct you should see that the service is active and running.
Step 6 Verify Synchronization
To confirm that your time synchronization is working properly
chronic tracking
This command shows you the system offset frequency correction and last update time. These values tell you how closely your system clock is following the correct time source.
Step 7 Adjust Firewall Settings If Needed
If your firewall server is active, allow outbound NTP traffic with
sudo ufw allow out 123/udp
This makes sure Chrony can communicate with time servers.
Insights from Real Usage
Many administrators wonder why Chrony is better than ntpd in real world use. Based on my experience there are several clear reasons. Chrony synchronizes time within seconds even when a server is freshly booted while ntpd can take several minutes. It remains stable in poor network conditions and automatically corrects itself after packet loss or disconnection. It consumes minimal resources which means it performs well even on low memory VPS systems!!! Chrony is also more suitable for modern server environments such as Docker containers and cloud based virtual machines where time drift happens frequently. Its algorithm can adapt quickly to virtualized clock inconsistencies and still maintain precise synchronization .
Troubleshooting and tips
If Chrony does not sync correctly follow these checks
1 Run chronyc sources to confirm that your NTP servers are reachable
2 Restart Chrony using sudo systemctl restart chronyd after changing configuration files
3 Make sure port 123 UDP is open in your firewall settings
Sometimes small network delays or misconfigured DNS can also affect synchronization speed. In those cases switching to a different pool or using a nearby region servesr often solves the issue.
Conclusion
By completing these steps you have successfully installed and configured Chrony on Ubuntu 20.04 . It is a simple but powerful tool that silently keeps your system clock accurate and your logs consistent!!! Once it is set up it requires almost no maintenance and can run for months or years without any manual adjustment. Chrony is one of those utilities that you install once and then simply forget because it just works. With it your server stays reliable, your certificates stay valid and your scheduled jobs run exactly when they should.
Chrony is a modern implementation of the Network Time Protocol (NTP) that keeps your system clock synchronized with internet time servers. It ensures accurate timestamps, reliable cron jobs, and stable system performance especially on VPS and virtual machines where clock drift is common.
Chrony synchronizes time much faster than ntpd and performs better on unstable or variable network connections. It's lightweight, adjusts quickly to system clock changes, and works efficiently even on low-resource or cloud-based environments.rn
You can check the synchronization status by running the command: "chronic tracking" This displays metrics like system offset, frequency, and update time. If you see a small offset and regular updates, Chrony is working correctly.