Install chrony

Shardul | Apr 4, 2024 min read

To set up chrony (NTP service) using yum on a RHEL/CentOS-based system, follow these steps:

  1. Install chrony
sudo yum install -y chrony
  1. Start the chrony service
sudo systemctl start chronyd
  1. Enable chrony to start at boot
sudo systemctl enable chronyd
  1. Check service status
sudo systemctl status chronyd
  1. Verify time synchronization
chronyc tracking

You can also check sources:

chronyc sources -v  
  1. Configure NTP servers

Edit the config file:

sudo vi /etc/chrony.conf

Add or modify servers, for example:

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst

Then restart:

sudo systemctl restart chronyd

Those lines in chrony.conf tell your system where and how to sync time. Here’s what each part does:

server 0.pool.ntp.org iburst

  • server → Defines an NTP server your system will sync with
  • 0.pool.ntp.org → A public time server from the NTP Pool Project (a global cluster of time servers)
  • iburst → Speeds up initial synchronization

chrony (NTP) only keeps your system clock accurate (UTC time).To make your machine run on IST (Indian Standard Time), you must set the timezone.

  1. Set timezone to IST

Run:

sudo timedatectl set-timezone Asia/Kolkata
  1. Verify timezone
timedatectl

You should see:

Time zone: Asia/Kolkata (IST, +0530)