查看系统时间:
hwclock
设置更新时间:
# 安装utpdate工具
yum -y update
yum -y install utp ntpdate
# 设置系统时间与网络时间同步
ntpdate cn.pool.ntp.org
# 将系统时间写入硬件时间
hwclock —systohc
# 服务器时区设置(6和7设置不一样)
# centos7:
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
# centos6:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime