How to sync datetime in Centos 7 with ntp

This tutorial helps you keep your server synchronized automatically with ntpd service.

First of all, we need update our system:

sudo yum update -y

Next, install ntp:

sudo yum install -y ntp

Next, enable ntpd service run at startup

systemctl enable ntpd

Now check current status of ntpd

systemctl status ntpd

Restart ntpd if need:

systemctl restart ntpd

Check ntpd configuration at:

vi /etc/ntp.conf

Your pre-configured file will be something like this:

For more information about this file, see the man pages
 ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
 driftfile /var/lib/ntp/drift
 Permit time synchronization with our time source, but do not
 permit the source to query or modify the service on this system.
 restrict default nomodify notrap nopeer noquery
 Permit all access over the loopback interface.  This could
 be tightened as well, but to do so would effect some of
 the administrative functions.
 restrict ::1
 Hosts on local network are less restricted.
 restrict mask nomodify notrap
 Use public servers from the project.
 Please consider joining the pool (
 server iburst
 server iburst
 server iburst
 server iburst


Now check your system date time with command:

Related:  Create single python executable module