Centos – How to update a CentOS server’s time from an authoritative time server

centostime-synchronization

I have CentOS machine and each time I've noticed that the server loses correct time after a while. It is usually behind by several minutes after time passes from having manually set the correct time. Is there a mechanism whereby I can update the server with the time from a specific time server?

Best Answer

Use the ntp daemon. Run yum install ntp and ensure that the service is started via ntsysv or chkconfig ntpd on.

To get an immediate sync, run ntpdate time.apple.com (or something similar).