让Centos系统时间自动同步

浏览次数:2514 关键词 ( 时间  系统  Centos  )

yum安装ntpdate

yum install -y ntpdate

删除本地时间并更改时区为上海

rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

和时间服务器同步

ntpdate time.nist.gov

添加计划任务

vi /etc/crontab
添加一行
00 0 1 * * root ntpdate time.nist.gov