CentOS Linux Install and Configure NTP to Synchronize The System Clock

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 5m
  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.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 40 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
40 comments… add one
  • Jose Arellano Jun 28, 2008 @ 17:26

    Nice inof, but how do i configure a NTP server? i want to do this with a client and a server… Thanks

  • Vincent Feb 19, 2009 @ 17:39

    Thanks, very straight forward.

  • Pentav Feb 22, 2009 @ 9:34

    This helped me to fix my call of duty world at war server problem.

    Thank you.

  • Joe Mar 5, 2009 @ 23:46

    Does anyone know how to make it run ntpdate at certain time increments?
    Like every hour?

  • Spyisra Mar 10, 2009 @ 7:12

    Good info, very helpful.

  • Muzammil Apr 23, 2009 @ 4:38

    Thanks, very simple to install and configure. My time is synchronized now.

  • KSK May 28, 2009 @ 3:51

    nice information but please tell me about the client end that how i sync time server with clients

  • Pooyait Sep 15, 2009 @ 4:47

    thanks man

    very nice

    • Krishna Oct 14, 2014 @ 8:37

      is there a way where i can use my own server from which clients should sync time?

  • Kunal Jan 6, 2010 @ 10:19

    I did ntpdate 0.asia.pool.ntp.org
    and now all my servers showing different time. Any idea why
    server1 – Wed Jan 6 15:54:10 IST 2010
    server2 – Wed Jan 6 15:47:39 IST 2010
    server3 – Wed Jan 6 15:58:23 IST 2010

    For more infomation – My servers are in India
    Thanks in advance

  • JohnFen Feb 16, 2010 @ 21:17


    My guess: You are obtaining your time info from a pool, so each time you synchronize you’re really getting your time form a different server. This shouldn’t matter, but it seems that the different servers in that pool are not synchronized with each other. You could pick a single server out of the pool and synchronize with it directly on each of your servers.

    Or, even better, set up your own ntp server, have it synchronize with a quality outside time server, then have the rest of your servers sync up with the time server that you installed. That way, even if there’s an accuracy problem upstream, at least all of your servers will agree with each other.

  • Bahadir Feb 25, 2010 @ 14:44

    I have this error:

    ntpdate[14060]: step-systime: Operation not permitted

    • Anonymous Jun 4, 2010 @ 11:25

      This is likely related to the server being a virtual server. It is not possible to sync to ntp in a VPS because the clock is inherited from the hardware that you are hosted on.

      I just ran across the same problem.

  • Matt Apr 28, 2010 @ 6:27

    Very useful

  • Bajinder May 31, 2010 @ 4:17

    Very Helpful :)

  • Ahmed Jaafar Sep 1, 2010 @ 0:34

    Replying @Anonymous June 4, 2010

    Actually if you mean a Xen VM, you still can have your own independent system clock setting the following sysctl parameter.
    sysctl -w xen.independent_wallclock = 1;

    And you save it inside /etc/sysctl.conf

    • Jeffrey Roberts Oct 9, 2011 @ 13:10

      Thanks for this tip!

  • Pal Singh Oct 22, 2010 @ 22:06

    Thanks you for your instructions.

  • Koviko Apr 26, 2011 @ 13:25

    This is exactly what I was looking for. Thank you for this clear post. :)

  • Jimbo May 27, 2011 @ 17:58

    Thank you this was very helpful!

  • satish Jul 6, 2011 @ 9:44

    i have configured ntp server on my machine which runs rhel6
    but at the client side at the time of ntp setting it giving me error tha
    server is note reachable or doesn’t act as a ntp server and also i cant
    see the port of ntp is open on my system, will you please help me for this


  • zanami Jul 20, 2011 @ 2:09

    Thanks but setting up / configuriing ntp servers list would be useful also

  • Ruben Sep 7, 2011 @ 6:07

    Thank you very much, it was exactly as you said.

  • 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


  • Buddhi Aug 13, 2014 @ 17:53

    Thanks! you saved my day!

  • Carlo Oct 8, 2014 @ 8:31

    Thank you very much ! Very useful guide.

  • Scott Feb 12, 2015 @ 1:54


    I’m having a small issue on Fedora 21: when my computer goes to sleep, I lose time synchronization and have to manually restart ntpd when I wake it in order to resync. Any idea how to fix this?

  • Ed Jun 22, 2015 @ 10:39

    Great tutorial! Thanks so much from Brazil.

  • Linda Jan 21, 2016 @ 1:56

    Thanks! Very helpful.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum