安装,启动ntp,并设置为开机自启动
yum -y install ntp
systemctl start ntpd
systemctl enable ntpd
配置计划任务,使用ntpdate同步时间
# 启动并开机启动计划任务cron
systemctl start crond
systemctl enable crond
# 配置计划任务,每5分钟同步一次
crontab -e
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com