NTP(Network Time Protocol,网络时间协议)是用来使网络中的各个计算机时间同步的一种协议.它的用于是把计算机的时钟同步到世界协调时UTC,其精度在局域网内可达0.1ms,在网络网上绝大多数的地方其精度可以达到1-50ms.
1.chrony服务部署
//查看一下由哪个包提供的
[root@ntp-server ~]# yum provides chronyd
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
chrony-3.1-2.el7.x86_64 : An NTP client/server
Repo : dvd
Matched from:
Filename : /usr/sbin/chronyd
//安装chrony服务
[root@ntp-server ~]# yum install chrony
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
dvd | 4.1 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package chrony.x86_64 0:3.1-2.el7 will be installed
--> Processing Dependency: libseccomp.so.2()(64bit) for package: chrony-3.1-2.el7.x86_64
--> Running transaction check
---> Package libseccomp.x86_64 0:2.3.1-3.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================
Package Arch Version Repository Size
==========================================================================================
Installing:
chrony x86_64 3.1-2.el7 dvd 237 k
Installing for dependencies:
libseccomp x86_64 2.3.1-3.el7 dvd 56 k
Transaction Summary
==========================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 293 k
Installed size: 761 k
Is this ok [y/d/N]: y
Downloading packages:
------------------------------------------------------------------------------------------
Total 1.6 MB/s | 293 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libseccomp-2.3.1-3.el7.x86_64 1/2
Installing : chrony-3.1-2.el7.x86_64 2/2
Verifying : chrony-3.1-2.el7.x86_64 1/2
Verifying : libseccomp-2.3.1-3.el7.x86_64 2/2
Installed:
chrony.x86_64 0:3.1-2.el7
Dependency Installed:
libseccomp.x86_64 0:2.3.1-3.el7
Complete!
//启动服务
[root@ntp-server ~]# systemctl start chrony
chrony-dnssrv@ chronyd.service chrony-wait.service
[root@ntp-server ~]# systemctl start chronyd
chrony服务相关命令
参数解释list-timezones 列出可用时区信息
set-timezone 设置时区
set-ntp 启用NTP
status 查看状态