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
  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
  • Carlo Oct 8, 2014 @ 8:31

    Thank you very much ! Very useful guide.

  • Scott Feb 12, 2015 @ 1:54

    Hi,

    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.
    Ed

  • Linda Jan 21, 2016 @ 1:56

    Thanks! Very helpful.

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.