To set up chrony (NTP service) using yum on a RHEL/CentOS-based system, follow these steps:
- Install chrony
sudo yum install -y chrony
- Start the chrony service
sudo systemctl start chronyd
- Enable chrony to start at boot
sudo systemctl enable chronyd
- Check service status
sudo systemctl status chronyd
- Verify time synchronization
chronyc tracking
You can also check sources:
chronyc sources -v
- 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.
- Set timezone to IST
Run:
sudo timedatectl set-timezone Asia/Kolkata
- Verify timezone
timedatectl
You should see:
Time zone: Asia/Kolkata (IST, +0530)