How to Install Chrony (NTP) on RHEL / CentOS 8
The Chrony is a default NTP (Network Time Protocol) client as well as an NTP server on RHEL / CentOS 8.
Table of Contents
Check Current Time
At first, let’s check the current date & time:
timedatectlYou’ll see the output like:
Local time: Fri 2020-03-20 13:26:10 +06
Universal time: Fri 2020-03-20 07:26:10 UTC
RTC time: Fri 2020-03-20 07:20:10
Time zone: Asia/Dhaka (+06, +0600)
System clock synchronized: no
NTP service: no
RTC in local TZ: noThe System clock synchronized & the NTP service’s value is no.
Install Chrony
Chrony is available in the DNF package manager. Just run this command to install Chrony:
sudo dnf install -y chronyAfter installing Chrony, we need to start & enable:
# start
systemctl start chronyd
# enable
systemctl enable chronydWe can check the status of Chrony using this command:
systemctl status chronydCheck Time Again
Let’s check the time again:
timedatectlOutput:
Local time: Fri 2020-03-20 13:20:10 +06
Universal time: Fri 2020-03-20 07:20:10 UTC
RTC time: Fri 2020-03-20 07:20:10
Time zone: Asia/Dhaka (+06, +0600)
System clock synchronized: yes
NTP service: active
RTC in local TZ: noNow our server is showing the correct date & time. The System clock synchronized is yes & the NTP service’s value is active.
Config NTP Client
If you don’t know about the NTP client, you can skip this.
If you want to NTP client, open /etc/chrony.conf with your favorite editor:
sudo nano /etc/chrony.confTo configure a system as an NTP client, it needs to know which NTP servers it should ask for the current time. You can specify the servers using the pool or server directive.
Comment out the default NTP servers and set your server IP address:
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# pool 2.centos.pool.ntp.org iburst
server YOUR_SERVER_IPSave the file and restart Chrony:
sudo systemctl restart chronydCheck for NTP server sources. Your local NTP server should be listed:
chronyc sourcesCheck NTP client list on the NTP server:
chronyc clientsTo know more about Chrony, run this command:
man chronycThat’s all. Thank you.
Md Obydullah
Software Engineer | Ethical Hacker & Cybersecurity...
Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.