In this article, we will review how to configure NTP on RHEL9 using chrony. We will focus on the server-side setup and finish with the
In this article, we will review network time protocol (NTP) installation and configuration on a CentOS8 or RHEL8 operating system. As part of this process, we will focus on both the server-side and client-side setups for NTP.
Although chronyd has replaced ntpd as the default time service on RHEL8 and CentOS8 systems, there may be environments that still require an ntpd configuration–which is what this article deals with. However, if you haven’t already, look into migrating to chrony as it is the preferred and default standard in the latest versions of RHEL and CentOS.
Here’s a step-by-step process for installing, configuring, and using NTP on a CentOS 8 machine.
$ sudo dnf install ntp
Once the installation is complete, start and enable the NTP service to ensure that it starts automatically on system boot.
$ sudo systemctl start ntpd
$ sudo systemctl enable ntpd
$ sudo systemctl status ntpd
If the service is not running, check the NTP configuration file located at /etc/ntp.conf
. By default, it should contain the following server lines:
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
If you want to use different NTP servers, replace the default servers with your own::
server ntp.example.com
server ntp2.example.com
$ sudo systemctl restart ntpd
Verify that the NTP service is synchronized with the configured NTP servers using the ntpq
command:
$ ntpq -p
The output should list the NTP servers that are currently being used, along with their reachability, delay, offset, and jitter values:
remote refid st t when poll reach delay offset jitter
==============================================================================
+ntp.example.com 10.0.0.1 3 u 734 1024 377 1.234 -0.123 0.456
-ntp2.example.com 10.0.0.2 2 u 804 1024 377 1.345 0.123 0.567
Once the NTP service is running and synchronized with the configured servers, you can use the date
command to check the system time:
$ date
If the system time is incorrect, you can manually synchronize it with the NTP servers using the ntpdate
command:
$ sudo ntpdate ntp.example.com
Alternatively, you can configure the system to automatically synchronize the time with the NTP servers by adding the following line to the /etc/crontab
file:
*/15 * * * * root /usr/sbin/ntpdate ntp.example.com > /dev/null 2>&1
This will synchronize the system time with the NTP server every 15 minutes.
That’s it! Now your CentOS 8 machine is configured to use NTP for accurate time synchronization. Was this article helpful to you? If so, leave us a comment. We’d love to hear from you!
Related Posts
In this article, we will review how to configure NTP on RHEL9 using chrony. We will focus on the server-side setup and finish with the
Table of Contents Introduction According to the Linux manual pages (man yum), there are 35 standard YUM commands. That number increases to the hundreds when
In today’s tutorial, we will install CentOS8 on KVM. The install process is fairly straightforward and we will cover it here step-by-step. We will follow