搭建时间服务器
(一)、chrony时间服务器
1.1 服务器端 Centos7.X
# 卸载ntp时间服务器,只采用chrony时间服务器yum remove ntp*;yum -y install ntpdate
# 安装 yum install chrony
# 启用 systemctl start chronyd
# 设置开机启动systemctl enable chronyd
# 设置亚洲时区 timedatectl set-timezone Asia/Shanghai
# 启用NTP同步 timedatectl set-ntp yes
服务器端配置文件修改
# vi /etc/chrony.conf
server time.tianqi.com iburst
local stratum 10
# 重启chronyd服务 systemctl restart chronyd
# timedatectl
1.2 客户端
# 安装 yum install chrony
# 启用 systemctl start chronyd 或 service chronyd start
# 设置开机启动systemctl enable chronyd 或 chkconfig chronyd on
客户端配置文件修改
# vi /etc/chrony.conf
server 时间服务器的ip iburst
# 重启chronyd服务 systemctl restart chronyd 或 service chronyd start
# 查看时间同步的信息来源 加-v参数查看状态信息的说明chronyc sources -v
返回时间服务器端
# timedatectl
NTP synchronized: yes
说明正常
(二)、ntp时间服务器
2.1 NTP时间服务器端
# 安装NTP服务yum install -y ntp ntpdate
修改ntp时间服务器配置文件
编辑配置文件 /etc/ntp.conf
#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
server time.tianqi.com iburst
server localhost iburst
fudge localhost stratum 10
保存配置文件后,重启ntpd服务,设置该服务开机自动启动
# service ntpd restart
# chkconfig ntpd on
2.2 客户端
客户端只安装或保留ntpdate时间客户端软件
# ntpdate 222.186.169.10
27 Aug 16:54:55 ntpdate[62686]: adjust time server 222.186.169.10 offset 0.001680 sec
说明正常