使用Almalinux 8 搭建NTP服务器chrony
原创
©著作权归作者所有:来自51CTO博客作者XuQingjia的原创作品,请联系作者获取转载授权,否则将追究法律责任
chrony官方网站
https://chrony-project.org/
1、更新系统
sudo dnf update
sudo dnf install epel-release
2、在AlmaLinux上安装NTP服务器
dnf install chrony
systemctl enable chronyd
systemctl start chronyd
3、 配置服务器
vim /etc/chrony.conf
添加NTP服务器地址,如
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp.ntsc.ac.cn iburst
#重启服务
systemctl restart chronyd
4、查看状态
#查看时间源同步状态
chronyc sourcestats -v
#查看当前时间
date
#查看时间源是否在线
chronyc activity -v
# 查看时间源状态
chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* dns2.synet.edu.cn 1 6 363 58 +11ms[ +11ms] +/- 24ms
^+ 139.199.214.202 2 6 377 55 +1379us[+1379us] +/- 39ms
^- stratum2-1.ntp.mow01.ru.> 2 6 377 59 +17ms[ +17ms] +/- 79ms
^- 119.28.206.193 2 6 176 189 +3506us[+3349us] +/- 54ms
^+ 203.107.6.88 2 6 377 60 -8530us[-8434us] +/- 21ms
^+ 120.25.115.20 2 6 277 118 +2670us[+2771us] +/- 26ms
^- 114.118.7.161 1 7 25 56 +29ms[ +29ms] +/- 43ms
5、配置防火墙
sudo firewall-cmd --permanent --add-service=ntp
sudo firewall-cmd --reload