安装ntp
yum install -y ntp
设置防火墙
firewall-cmd --zone=public --add-port=123/udp --permanent
更新防火墙
firewall-cmd --reload
编辑ntp配置
vi /etc/ntp.conf
注释掉原先server,添加两行
server time1.aliyun.com
fudge 127.127.1.0 stratum 11
添加开机时间同步,和同步后启动ntpd服务
chmod +x /etc/rc.d/rc.local
vi /etc/rc.local
添加两行
/usr/sbin/ntpdate time1.aliyun.com
systemctl start ntpd
重启
reboot