环境
CentOS Linux release 7.9.2009 (Core)
工具
chrony-2.2.1.tar.gz 下载地址:https://download.tuxfamily.org/chrony/
安装步骤
删除原chrony
yum remove -y chrony
如果之前是编译安装的可以选择不删除,在安装时把旧版本覆盖掉。
安装chrony
#解压
[root@localhost ~]# tar zxvf chrony-2.2.1.tar.gz
[root@localhost ~]# cd chrony-2.2.1
#编译安装
[root@localhost chrony-2.2.1]# ./configure --prefix=/usr
[root@localhost chrony-2.2.1]# make
[root@localhost chrony-2.2.1]# make install
#查看版本
[root@localhost chrony-2.2.1]# chronyd -v
chronyd (chrony) version 2.2.1 (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER +SECHASH +ASYNCDNS +IPV6 -DEBUG)
#部署配置文件和服务控制脚本
[root@localhost chrony-2.2.1]# cp examples/chrony.conf.example2 /etc/chrony.conf
[root@localhost chrony-2.2.1]# cp examples/chrony*.service /usr/lib/systemd/system/
[root@localhost chrony-2.2.1]# ls /usr/lib/systemd/system/chrony*.service
/usr/lib/systemd/system/chronyd.service /usr/lib/systemd/system/chrony-wait.service
#启动服务
[root@localhost chrony-2.2.1]# systemctl start chronyd.service
#加入开机自启
[root@localhost chrony-2.2.1]# systemctl enable chronyd.service
#检查服务状态
[root@localhost chrony-2.2.1]# systemctl status chronyd.service
配置chrony
[root@localhost chrony-2.2.1]# vim /etc/chrony.conf
#编辑改行,设置ntp服务器地址,pool.ntp.org 替换为ntp服务器地址
pool pool.ntp.org iburst
#重启chrony
查看状态
[root@localhost chrony-2.2.1]# chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 192.168.6.202 2 6 37 60 -50us[ +603us] +/- 1329us
^*表示当前同步的服务器
end.
标签:service,centos,离线,chrony,chronyd,2.2,root,localhost From: https://www.cnblogs.com/xujiecnblogs/p/17222449.html