Friday, May 31, 2019

Update time and date using chrony

Chrony is an application for a machine to sync with network time protocol servers.

To install chrony
# yum install chrony -y

Then, make sure to include some legit ntp servers in /etc/chrony.conf. In this case, we are using centos ntp pool servers.
# cat /etc/chrony.conf
...
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

...

Start chronyd (chrony daemon)
# systemctl start chronyd

Chrony will gradually update the system clock to follow the ntp servers, once chronyd is started. But if you want to chrony to update the time quickly, just use below command
# chronyc makestep

To start chronyd on boot:
# systemctl enable chronyd

No comments: