centos7设置时间

1、查看时间时区

date

2、修改时区

timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海

3、安装ntp 联网校准时间

yum install ntp
systemctl start ntpd
systemctl enable ntpd
ntpdate ntp1.aliyun.com #联网(阿里时间服务器)校准时间

4、配置开机启动校验

vim /etc/rc.d/rc.local
/usr/sbin/ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w

5、配置定时任务

crontab -e
0 */1 * * * ntpdate ntp1.aliyun.com > /dev/null 2>&1; /sbin/hwclock -w
原文地址:https://www.cnblogs.com/shenyixin/p/11848056.html