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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. CentOS / RHEL 7 : How to disable all tty consoles and enable only 1
  2. Oracle Database Environment Variables and Their Functions
  3. CentOS / RHEL : How to restrict SSH login by time of day
  4. How to install CentOS / RHEL 7 on RAID Partition
  5. Comparing NET-TOOLS V/s IPROUTE Package Commands (ip Vs ifconfig command comparison)
  6. How to make alias command work in bash script or bashrc file
  7. MySQL Server Error – “Can’t Create A New Thread (errno 11)”
  8. How to enable the automatic extension for a thin LVM volume
  9. ‘ulimit: max user processes: cannot modify limit:operation not permitted’ Shown When Login
  10. How To Generate An CentOS/RHEL 6 UEFI Bootable ISO Image

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary