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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. ansible-doc – Display information on modules installed in Ansible libraries
  2. ledctl: command not found
  3. ‘Found duplicate PV’ warnings when using LVM with multipath storage in RHEL/CentOS
  4. CentOS / RHEL : How to backup/restore configuration using authconfig
  5. How to install zip/unzip package in Linux CentOS/RHEL 7 and 8
  6. scriptreplay: command not found
  7. “error: Bind to port 2222 on 0.0.0.0 failed: Permission denied” – error while starting sshd service on CentOS/RHEL
  8. fakedata: Generate fake data using a large variety of generators
  9. rfkill Command Examples in Linux
  10. gpasswd: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • “glab pipeline” Command Examples
  • “glab mr” Command Examples
  • “glab mr merge” Command Examples
  • “glab mr” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright