Change NTP server on a Linux system to a local NTP server

  1. Open the Chrony configuration file:
    sudo nano /etc/chrony/chrony.conf
    
  2. Find the existing NTP servers and comment them out by adding a # at the beginning of the line, or remove them if you prefer:
    # server 0.pool.ntp.org iburst
    # server 1.pool.ntp.org iburst
    
  3. Add your local NTP server:

    Replace local_ntp_server_ip with the IP address or hostname of your local NTP server:

    server local_ntp_server_ip iburst
    
  4. Save and exit the editor (for nano, press CTRL+X, then Y, and Enter).
  5. Restart the Chrony service to apply changes:
    sudo systemctl restart chronyd
    
  6. Verify the synchronization:

    After a few minutes, you can check the NTP synchronization status:

    chronyc sources