1、安装ntp服务,要使用时间同步、那么服务端与客户端都需要使用如下命令安装NTP软件包
[root@jw34 ~]# yum install ntp -y
2、如果只是作为客户端的话,配置则可以非常简单,编辑/etc/ntp.conf文件,注释掉默认的如下默认的4行
再加上我们的时间同步服务端的IP地址或者域名即可。
#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 //其中iburst :当一个运程NTP服务器不可用时,向它发送一系列的并发包进行检测。 server 192.168.100.140 iburst
3、然后重启ntpd.service服务,即可向上级NTP服务器进行时间同步
#systemctl restart ntpd.service
4丶最后输入data看时间是否与服务器同步
#data