Is production: true
#migrated #ntp

How to sync time in Linux

Created: 17 Mar 2023 Modified: 17 Mar 2023 Lang: English



[Link]

[Link2]

Instructions

  1. Install ntp

    1
    2
    3
    4
    5
    
    # In ubuntu
    apt-get install ntp
    
    #In centos
    yum install ntp
    
  2. Setup ntp server

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    
    #Edit server configuration
    sudo vim /etc/ntp.conf
    
    ====
    #Replace the {jp} to the country or replace the whole ntp server url
    pool 0.{jp}.pool.ntp.org iburst
    pool 1.{jp}.pool.ntp.org iburst
    pool 2.{jp}.pool.ntp.org iburst
    pool 3.{jp}.pool.ntp.org iburst
    ====
    
    #Restart server
    sudo service ntp status
    
  3. Verify

    1
    2
    3
    4
    5
    6
    7
    8
    
    #Install ntpstat
    sudo apt-get install ntpstat
    
    #Check ntp status
    ntpstat
    #synchronised to NTP server (133.243.238.243) at stratum 2
    #   time correct to within 19 ms
    #   polling server every 64 s