This article provides instructions on how to set up a Chrony NTP server in CentOS/RHEL 7 servers. Chrony is similar to an NTP server, but it's designed for systems that are frequently powered down or disconnected from the network. The main configuration file for Chrony is located at /etc/chrony.conf, and the chronyd daemon runs in user space. Chrony is a command-line program that provides a command prompt to obtain system time information and current sources.
Steps to Set up a Chrony NTP Server
Install Chrony: Use the following command to install the Chrony package on CentOS/RHEL 7 systems:
yum install chrony
Start Chrony at Startup: Use the following command to start Chrony at system startup:
systemctl start chronyd
systemctl enable chronyd
Configure Chrony: The following is an example of a simple configuration file:
grep -v '^#' /etc/chrony.conf
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
driftfile /var/lib/chrony/drift
makestep 1.0 3
logdir /var/log/chrony
The following are explanations of the simple configuration directives:
- server: Describes the NTP servers to be synchronized from.
- driftfile: Specifies the location and name of the file containing drift data.
- makestep: Gradually corrects any time offset by speeding up or slowing down the clock as required.
- logdir: Specifies the path to save all Chrony's logs.
Set System Clock at Runtime: Use the following command to set up the system clock at runtime:
chronyc makestep
Stop Chrony: Use the following command to stop Chrony:
For SystemD:
systemctl stop chrony
For Init:
/etc/init.d/chronyd stop
0 comments:
Post a Comment