1.安装
yum install ntp -y
2.启动
systemctl start ntpd; systemctl enable ntpd
3.配置
vim /etc/ntp.conf
#注释下面4行
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
替换成中国时间服务器:
#http://www.pool.ntp.org/zone/cn
server 0.cn.pool.ntp.org server 1.cn.pool.ntp.org server 2.cn.pool.ntp.org server 3.cn.pool.ntp.org
4.重启
systemctl restart ntpd