CentOS / Redhat Linux: Install OpenNTPD To Synchronize The Local Clock

CentOS / Redhat Linux: Install OpenNTPD To Synchronize The Local Clock

To install OpenNTPD on CentOS or Redhat Linux, follow these steps:

  1. Install the OpenNTPD package:
refer ‮t‬o:lautturi.com
yum install openntpd
  1. Start the OpenNTPD service and enable it to start automatically at boot time:
systemctl start openntpd
systemctl enable openntpd
  1. Confirm that the service is running by checking its status:
systemctl status openntpd

You should see output similar to this:

● openntpd.service - OpenNTPD System Clock Synchronization
   Loaded: loaded (/usr/lib/systemd/system/openntpd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-01-01 00:00:00 UTC; 1h 1min ago
 Main PID: 12345 (ntpd)
   CGroup: /system.slice/openntpd.service
           └─12345 /usr/sbin/ntpd -s
  1. Set the timezone for your system. OpenNTPD uses the local timezone setting to determine the correct time to display. You can set the timezone using the timedatectl utility:
timedatectl set-timezone America/New_York

Replace America/New_York with the timezone that is appropriate for your location. You can see a list of available timezones by running timedatectl list-timezones.

  1. Check the current time and confirm that it is synchronized with a time server. You can use the ntpq utility to check the status of the OpenNTPD service:
ntpq -p

You should see output similar to this:

remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*timeserver.example.com .LOCL.           1 u   51   64  377    0.672   -4.698   1.620

The * indicates the current time source that OpenNTPD is using. The reach field indicates the status of the connection to the time server, with a value of 377 indicating a successful connection.

That's it! OpenNTPD should now be installed and configured on your system, and your local clock should be synchronized with a time server.

Created Time:2017-10-27 14:56:37  Author:lautturi