1. 修改时区
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
vim /etc/sysconfig/clock
ZONE="Asia/Shanghai"
UTC=false
ARC=false
  1. 安装并设置开机启动
    yum install -y ntp
    systemctl start ntpd
    systemctl enable ntpd
  1. 配置开机启动校验
vim /etc/rc.d/rc.local
/usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
  1. 配置定时任务
crontab -e
0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
最后修改:2023 年 02 月 19 日
如果觉得我的文章对你有用,请随意赞赏