In this tutorial, How to Install Chrony and Configure NTP server in Linux. Chrony is used to sync the system clock from different NTP servers.
Chrony with two programs: chronyc is the command-line interface for chrony and chronyd is the daemon that can be started at boot time.
Table of Contents
Install chrony
# yum -y install chrony # CentOS/RHEL
# apt install chrony # Debian/Ubuntu
# dnf -y install chrony # Fedora 22+
Configure chrony
[vagrant@DevopsRoles ~]$ sudo vi /etc/chrony.conf
Example add lines as below
# change servers for synchronization
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
# Allow NTP client access from local network.
allow 10.0.2.0/24
Start and enable daemon upon boot
[vagrant@DevopsRoles ~]$ sudo systemctl start chronyd
[vagrant@DevopsRoles ~]$ sudo systemctl enable chronyd
If Firewalld is running, allow port 123/UDP.
[vagrant@DevopsRoles ~]$ sudo firewall-cmd --add-service=ntp --permanent
[vagrant@DevopsRoles ~]$ sudo firewall-cmd --reload
Check Chrony Synchronization
[vagrant@DevopsRoles ~]$ chronyc sources
[vagrant@DevopsRoles ~]$ chronyc tracking
Conclusion
You have installed Chrony and Configured the NTP server. I hope will this your helpful. Thank you for reading the DevopsRoles page!