Wednesday, October 2, 2013

How to Sync Time on CentOS

To ensure that your system is always using the correct time, you can sync the hardware clock with a remote time server. This can be done in CentOS by using the NTP service which is not installed by default.
  1. Install NTP service


  2. [root@glt ~]# yum install ntp

  3. Turn on service


  4. [root@glt ~]# chkconfig ntpd on

  5. Synchronize with time server in your zone

  6. Continental Zones URL
    Europe europe.pool.ntp.org
    Asia asia.pool.ntp.org
    Oceania oceania.pool.ntp.org
    North America north-america.pool.ntp.org
    South America south-america.pool.ntp.org
    Africa africa.pool.ntp.org

    [root@glt ntp]# ntpdate  north-america.pool.ntp.org
     1 Oct 22:30:26 ntpdate[14429]: adjust time server 72.14.183.239 offset 0.011128 sec

  7. Start the NTP service


  8. [root@glt ~]# /etc/init.d/ntpd start

  9. Verify that the NTP service is working


  10. [root@glt ntp]#  ntpq -pn
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
     +198.58.100.237  127.67.113.92    2 u   40   64    1   58.513   -0.780   0.002
     +151.236.20.4    193.190.230.65   2 u   39   64    1  260.159    5.373   0.002
     *66.175.216.101  127.67.113.92    2 u   38   64    1   81.630   -5.700   0.002