How to Install and Configure NTP for Time Synchronization in CentOS?

Updated on September 3, 2017

I was recently working on a Grid Computing project, where I had to install a grid middleware called Globus Toolkit. If you had ever worked on Globus Toolkit, then you might be aware that it uses a security module called Grid Security Infrastructure (GSI), which actually works based on Public Key Infrastructure (PKI). It means, all grid computing related transactions are happened over X.509 digital certificates for authentication and authorization. So it’s quite important to have all the machines that are involved in grid computation to be synchronized with a common time server. That’s probably why I ended up in installing NTP on those machines.

To the point, I’m going to share how to install and configure NTP on CentOS machines.

steps to install ntp on linux

What is NTP?

NTP stands for Network Time Protocol, which actually send time signals over the network to synchronize NTP clients (the description is enough for now and you can find better explanation at ntp.org). NTP can be installed using ‘yum‘ command.

Install NTP

#yum install ntp
 ....................
 Installed:
 ntp.x86_64 0:4.2.6p5-2.el6.centos
 Dependency Installed:
 ntpdate.x86_64 0:4.2.6p5-2.el6.centos
 Complete!

Configure ‘ntpd’ to start during the boot

# chkconfig ntpd on

Update NTP

# ntpdate pool.ntp.org

Start ‘ntpd’ daemon

# service ntpd start
 or
# /etc/init.d/ntpd start

NTPSTAT
You can also run ntpstat after configuring ‘server’ in /etc/ntp.conf.

# ntpstat
unsynchronised
time server re-starting
polling server every 8 s

Configure NTP

# vim /etc/ntp.conf

and add the below lines…

server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server 3.centos.pool.ntp.org

By default, the public NTP pool servers (for CentOS) would have been added to the ntp.conf file. The ‘server’ attribute can be used to add your organization’s NTP server as well.

For example,

server ntp.yourorganization.org

That’s it!

Was this article helpful?

Related Articles

Leave a Comment