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.
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.