How Configure CentOS to Sync Time with NTP Time Servers

Hafez Heybati Goujani
1 min readSep 22, 2021

--

The Scenario

The system is not configured to use the ntpd service to synchronize time and date.

CentOS/RHEL 7 uses systemd to manage services. The timedatectl utility is distributed as part of the systemd, and allows you to review and change the configuration of the system clock: change the current date and time, set the time zone, or enable automatic synchronization of the system clock with a remote server.

The NTP service is enabled, but as this system is running CentOS/RHEL 7, timedatectl also needs to be configured to enable NTP, as it is used to manage the date and time on the system.

# timedatectl
...
NTP enabled: no
...

This shows system is not using NTP.

The Solution

you can install it using yum in CentOS 7:

# yum install ntp -y

Force NTP usage for time synchronisation:

# timedatectl set-ntp 1

Then do the following:

1. Restart systemd time date control.

# systemctl restart systemd-timedated.service

2. Start the ntp service

# systemctl start ntpd

3. Sync the time with the remote server

# ntpq -p

--

--

No responses yet