Commit 302cdab26125ee172bf8ae06d234486ca9049c13
1 parent
52b1f77e
Updates 01_basic/ntp.md
Auto commit by GitBook Editor
Showing
1 changed file
with
21 additions
and
0 deletions
01_basic/ntp.md
| 1 | 1 | # ntp时间校验组件安装 |
| 2 | 2 | |
| 3 | 3 | ### Centos7上使用chrony组件 |
| 4 | +``` | |
| 5 | +//---------- linux时间同步 ----------// | |
| 6 | +// 查看是否安装了chrony | |
| 7 | +rpm -qa|grep chrony | |
| 8 | +// 没有找到,yum安装 | |
| 9 | +yum install chrony -y | |
| 10 | +// 修改/etc/chrony.conf配置文件 | |
| 11 | +// 启动chrony服务,加入开机启动项,查看状态 | |
| 12 | +systemctl enable chronyd.service | |
| 13 | +systemctl restart chronyd.service | |
| 14 | +systemctl status chronyd.service | |
| 15 | +// 查看时间源服务器状态 | |
| 16 | +chronyc sources -v | |
| 17 | +chronyc sourcestats -v | |
| 18 | +chronyc activity | |
| 19 | +// 手动同步时间 | |
| 20 | +chronyc -a makestep | |
| 21 | +// 与timedatectl关联(TODO:里面NTP syncronized总是no,再议) | |
| 22 | +timedatectl set-ntp 1 | |
| 23 | +``` | |
| 24 | + | |
| 4 | 25 | ... | ... |