• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Install NTP Service and Client in CentOS/RHEL 8

by admin

In CentOS/RHEL 8, ntp is no longer supported. chrony is enabled by default. For this reason, you might need to migrate from ntp to chrony.

Note: In CentOS/RHEL 7 users had a choice to between ntp and chrony. But Starting from CentOS/RHEL 8, they have to use chrony instead of ntp.

In standard CentOS/RHEL 8 servers, chrony should be installed and active already. It can be verified by executing:

# systemctl status chronyd

● chronyd.service - NTP client/server
  Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
  Active: active (running) since Mon 2021-01-25 16:31:25 GMT; 2 days ago
  Docs: man:chronyd(8)
  man:chrony.conf(5)
  Process: 1401 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
  Process: 1388 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 1397 (chronyd)
  Tasks: 1 (limit: 100197)
  Memory: 2.0M
  CGroup: /system.slice/chronyd.service
  └─1397 /usr/sbin/chronyd

The chronyc command can be used as the client, for example to check for the existing sources with:

# chronyc sources

210 Number of sources = 1
MS  Name/IP address  Stratum Poll Reach LastRx Last sample
===============================================================================
^*  xxx.xxx.xxx.xxx  2 10 377 130 -40us[ -71us] +/- 36ms

And in the unlikely event that chrony is not installed, the package can be installed via yum, by installing chrony:

# yum install chrony

NTP vs Chrony

Below is an summary of comparison between NTP and chrony:

ntp name chrony name
/etc/ntp.conf /etc/chrony.conf
/etc/ntp/keys /etc/chrony.keys
ntpd chronyd
ntpq chronyc
ntpd.service chronyd.service
ntp-wait.service chrony-wait.service

Migrating from NTP to chrony

RedHat provides a nice script which can directly convert your NTP settings to chrony. The script /usr/share/doc/chrony/ntp2chrony.py in included by default along with chrony in CentOS/RHEL 8. The script automatically converts an existing ntp configuration to chrony.

Below is an example of converting your NTP configuration to chrony using the script:

# python3 /usr/share/doc/chrony/ntp2chrony.py -b -v
Reading /etc/ntp.conf
Reading /etc/ntp/crypto/pw
Reading /etc/ntp/keys
Writing /etc/chrony.conf
Writing /etc/chrony.keys

Here,
-b – backups original /etc/chrony.conf or /etc/chrony.keys before making any changes.
-v – versbose printing.

Any unsupported directives from ntp.conf are included in the chrony.conf as comments.

Filed Under: CentOS/RHEL, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. Useful RHV Engine PostgreSQL Database Queries
  2. e2image: command not found
  3. Beginners Guide to DHCP – Install and configure DHCP server and client
  4. RHEL 7 – RHCSA Notes – System documentation including man, info, and files in /usr/share/doc
  5. flash Command Examples in Linux
  6. How to Partition DM-Multipath Pseudo Devices in CentOS/RHEL
  7. dracut: command not found
  8. shred: command not found
  9. Passwordless SSH not working for local users on LDAP servers – CentOS/RHEL 7
  10. Understanding SELinux Policies in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • fprintd-delete Command Examples in Linux
  • fprintd-delete: command not found
  • foreman: command not found
  • foreman Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright