Centos – 查看、修改、更新系统时间

一、查看系统时间

1
2
[root@k8s-master01 ~]# date
20220710日 星期日 13:10:18 CST

二、手动修改系统时间

(1)设置时间

date -s "20190712 18:30:50"

(2)保存设置
hwclock --systohc

三、通过网络同步时间

(1)安装 ntpdate 命令

1
yum install -y ntpdate

(2)开始同步

1
2
3
ntpdate 0.asia.pool.ntp.org
# 强制把系统时间写入CMOS
clock -w

若上面的时间服务器不可用,也可以改用如下服务器进行同步:
time.nist.gov
time.nuri.net
0.asia.pool.ntp.org
1.asia.pool.ntp.org
2.asia.pool.ntp.org
3.asia.pool.ntp.org
ntp.aliyun.com

(3)将系统时间同步到硬件,防止系统重启后时间被还原。

1
2
ntpdate 0.asia.pool.ntp.org
hwclock --systohc

Centos – 查看、修改、更新系统时间
https://leellun.github.io/2020/03/03/centos/Centos – 查看、修改、更新系统时间/
作者
leellun
发布于
2020年3月3日
许可协议