Centos7 修改系统时间和硬件时间不一致的问题

  • 查看系统时间

[root@localhost ~]# date
Sat Feb 24 14:41:22 CST 2018

  • 查看硬件时间

[root@localhost ~]# hwclock --show
Sat 24 Feb 2018 02:40:39 PM CST -0.241654 seconds

  • 更新系统年月日
[root@localhost ~]# timedatectl set-time 2018-02-24
  • 更新系统时分秒
[root@localhost ~]# timedatectl set-time 14:42:59
  • 更新时区(亚洲-中国-上海)
[root@localhost ~]# timedatectl set-timezone Asia/Shanghai
  • 将硬件时钟调整为与系统时钟一致
[root@localhost ~]# timedatectl set-local-rtc 1
或者
[root@localhost ~]# hwclock --systohc --localtime 
  • 将日期写入CMOS
[root@localhost ~]# clock –w
  • 再次查看系统时间和硬件时间

同步网络时间:

安装插件

yum -y install ntp

更新时间

ntpdate time.nist.gov

(此方法在网络禁止udp或123port的情况下无法成功)

更新与某一服务器时间一致

ntpdate -d ip

 

posted @ 2018-02-24 14:54  fuhaizi  阅读(644)  评论(0编辑  收藏  举报