切到root用户,执行下面的命令:
timedatectl set-timezone Asia/Shanghai
确认是否修改成功:
1、看系统时间有没有变成北京时间
2、或者timedatectl status查看当前状态
[root@localhost ~]# timedatectl status
Local time: Tue 2026-06-02 22:33:23 CST
Universal time: Tue 2026-06-02 14:33:23 UTC
RTC time: Tue 2026-06-02 14:33:23
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a