In this tutorial we will learn how to install, configure and use NTP to synchronize the system clock on CentOS.
Tutorial Topology :
Working Internet Connection
To install NTP, type the following command :
yum install ntp
To ensure that the NTP client start at boot time, let add it into config for level 3, 4 and 5 by typing the following command :
chkconfig --level 345 ntpd on
To synchronize the system clock with the Internet (such as NTP.org), type the following command :
Manage the NTP Service :
To start the NTP service, type the following command:
/sbin/service ntpd start
To restart the NTP service, type the following command:
/sbin/service ntpd restart
To stop the NTP service, type the following command:
/sbin/service ntpd stop
You could also setup a cron with crontab to run the ntpdate at a specific interval at your convenience. Don’t forget to make sure that you have a working Internet Connection and that proper firewall rule have been added to allow the traffic, otherwise it might not work properly.