安装时间同步服务chrony
时间: 2023-12-08 07:05:15 浏览: 188
安装时间同步服务chrony的步骤如下:
1.使用以下命令安装chrony:
```shell
yum install chrony -y
```
2.安装完成后,使用以下命令启动chrony服务并设置开机自启动:
```shell
systemctl start chronyd
systemctl enable chronyd
```
3.如果需要配置chrony服务器,可以编辑/etc/chrony.conf文件进行配置。例如,如果需要将本机作为时间同步服务器,可以在文件中添加以下内容:
```shell
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
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
# Ignore stratum in source selection.
stratumweight 0
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Enable kernel RTC synchronization.
rtcsync
# In first three updates step the system clock instead of slew
makestep 1 -1
# Allow NTP client access from local network.
allow 192.168.0.0/16
# Serve time even if not synchronized to a time source.
local stratum 10
# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys
# Specify directory for log files.
logdir /var/log/chrony
```
4.编辑完成后,使用以下命令重启chrony服务使配置生效:
```shell
systemctl restart chronyd
```
阅读全文
相关推荐

















