1.安装ntp
yum install ntp -y
2.配置ntp同步的服务器
vi /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 (注释掉如上4行,同步自己定义的服务器)
server 192.168.1.3
server 192.168.1.2 prefer (prefer优先服务器)
logfile /var/log/ntp.log (日志记录)
3.开启自启动ntpd服务器并启动。
systemctl enable ntpd
systemctl start ntpd
同步时间工具安装ntpdate
yum install ntpdate -y
ntpdate 服务器 (同步和服务器的时间)