Linux centos 时间同步

187 阅读1分钟
  1. 安装ntpdate(本机有则不需要重复安装)
sudo yum -y install ntp ntpdate
  1. 命令行同步
sudo ntpdate cn.pool.ntp.org

最后的cn.pool.ntp.org是时间同步地址
如果失效了可以换这几个试试
time.nuri.net
ntp1.aliyun.com
cn.ntp.org.cn
edu.ntp.org.cn
tw.ntp.org.cn
us.ntp.org.cn
sgp.ntp.org.cn
kr.ntp.org.cn
de.ntp.org.cn
jp.ntp.org.cn

  1. 系统自动更新时间
    登陆su
    然后输入 crontab -e
    最后在vi中
    59 23 * * * ntpdate cn.ntp.org.cn
    填写并保存