+-
系统时间同步的方式

在生成密钥前要确保时间正确并同步

立即同步:ntpdate 172.18.0.1 与服务器同步,立即生效

出现此错误时,the NTP socket is in use, exiting

执行此操作:service ntpd stop

一直与服务器保持同步方式:

修改配置文件:centos6

vim /etc/ntp.conf (配置文件)

server 172.18.0.1 iburst (在server 0前加一行)

chkconfig --list ntpd (查看服务默认开启情况)

chkconfig ntpd on (设置ntp服务默认开启)

service ntpd start (开启服务)

修改配置文件:centos7

rpm -ql chrony (查看软件包中的文件)

vim /etc/chrony.conf (配置文件)

server 172.18.0.1 iburst (在server 0前加一行)

systemctl is-enabled chronyd (查看服务默认开启情况)

systemctl enable chronyd(设置ntp服务默认开启)

systemctl start chronyd (开启服务)