CentOS Linux Install and Configure NTP to Synchronize The System Clock

See all Redhat/CentOS/Fedora Core related FAQ
How do I install and configure NTP under CentOS Linux version 5.x or 6.x server to synchronize the system clock?

You can easily install NTP (Network Time Protocol, a means of transmitting time signals over a computer network) using the yum command under Red Hat or CentOS/Fedora Linux server or workstation based systems. You need to install the following packages:
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements NTPD server
Est. reading time 1 minutes
Advertisement

  1. ntp : ntpd server which continuously adjusts system time and utilities used to query and configure the ntpd daemon.
  2. ntpdate : Utility to set the date and time via NTP.
  3. ntp-doc : NTP documentation

Procedure: Setup NTPD on CentOS Linux

Open the terminal or login over the ssh session. You must login as as the root user. Type the following yum command to install ntp
# yum install ntp ntpdate ntp-doc

Turn on service, enter:
# chkconfig ntpd on

Synchronize the system clock with 0.pool.ntp.org server (use this command only once or as required):
# ntpdate pool.ntp.org

Start the NTP server. The following will continuously adjusts system time from upstream NTP server. No need to run ntpdate:
# /etc/init.d/ntpd start

Configure ntpd (optional)

Edit /etc/ntp.conf, enter:
# vi /etc/ntp.conf
Set public servers from the pool.ntp.org project:

server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org

See this tutorial on how to configure NTPD for LAN based client on RHEL / CentOS Linux for more information.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

40 comments… add one
  • Amin Jan 4, 2012 @ 17:41

    Thanks a lot. great howto…

  • seachen Mar 20, 2012 @ 17:45

    i am from Malaysia. which server should i use ?

  • ajd May 8, 2012 @ 9:26

    Great post ,, and it works as a charm :) ,, thank you very much

  • Enrique May 30, 2012 @ 17:22

    Thanks a lot for your concise post.

  • Emil Stoyanov Jun 11, 2012 @ 12:49

    The following command will additionally update your hardware clock

    hwclock –systohc

  • s.khademi Jun 12, 2012 @ 21:11

    Very helpful. Thanks

  • Fred Sep 3, 2012 @ 14:50

    You dont need to have an ntp server running in your machine in order to have the time synced, it is as easy as having cron do the syncing with the ‘ntpclient’ command.

    • Ravindra Gohil Sep 10, 2012 @ 5:49

      Hi Fred,
      Could you please share script to sync with ntp server. so that i can run the same as a cron job.

  • Leon Nov 25, 2012 @ 0:58

    Thank you much.

  • Wellington Torrejais da Silva May 19, 2014 @ 14:37

    Thanks!!!

  • Buddhi Aug 13, 2014 @ 17:53

    Thanks! you saved my day!

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.