

非上海[root@node01 ~]$ timedatectl
Local time: 日 2022-09-18 10:22:31 GMT
Universal time: 日 2022-09-18 10:22:31 UTC
RTC time: 日 2022-09-18 10:22:31
Time zone: Atlantic/Reykjavik (GMT, +0000)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
❝此处为
Atlantic/Reykjavik不是上海时区,需要更改 ❞
[root@node01 ~]$ timedatectl set-timezone Asia/Shanghai
[root@node01 ~]$ timedatectl
Local time: 日 2022-09-18 18:36:25 CST
Universal time: 日 2022-09-18 10:36:25 UTC
RTC time: 日 2022-09-18 10:36:25
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: n/a
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
[root@node01 ~]$ ls /usr/share/zoneinfo/
Africa Atlantic Chile Eire GB GMT+0 Indian Japan Mexico NZ-CHAT posixrules ROK Universal zone1970.tab
America Australia CST6CDT EST GB-Eire Greenwich Iran Kwajalein MST Pacific PRC Singapore US zone.tab
Antarctica Brazil Cuba EST5EDT GMT Hongkong iso3166.tab leapseconds MST7MDT Poland PST8PDT Turkey UTC Zulu
Arctic Canada EET Etc GMT0 HST Israel Libya Navajo Portugal right tzdata.zi WET
Asia CET Egypt Europe GMT-0 Iceland Jamaica MET NZ posix ROC UCT W-SU
[root@node01 ~]$ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
❝需要提前安装ntp时间服务器 ❞
# 安装ntpdate
[root@node01 ~]$ yum install -y ntpdate
# 同步时间
[root@node01 ~]$ ntpdate asia.pool.ntp.org
# 为了校对网络时间,将ntpdate服务设置为自启动,
[root@node01 ~]$ systemctl enable ntpdate.service
#启动ntp服务
[root@node01 ~]$ service ntpd restart
#查看时间
[root@node01 ~]$ timedatectl
❝https://cxymm.net/article/wngpenghao/117027687 ❞