1.查看当前时间
date
2.安装ntp
yum install ntpdate -y
3.校准时间
选择合适的ntp服务器,网上可以搜到很多
ntpdate -u cn.pool.ntp.org
或者
ntpdate -u edu.ntp.org.cn
出现以下命令,说明已完成校准
27 Sep 09:21:34 ntpdate[27152]: adjust time server 84.16.73.33 offset 0.001199 sec
4.修改时区
如果是机器时区和本地不一样,使用以下方法修改时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime