centos7 自动同步时间

Posted maxuebin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 自动同步时间相关的知识,希望对你有一定的参考价值。

rm -rf /etc/localtime

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

vim /etc/sysconfig/clock

ZONE="Asia/Shanghai"
UTC=false
ARC=false
 
 
yum install -y ntp
systemctl start ntpd
systemctl enable ntpd
 
vim /etc/rc.d/rc.local
/usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
 
crontab -e
0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w

以上是关于centos7 自动同步时间的主要内容,如果未能解决你的问题,请参考以下文章