1.編輯配置文件添加如下內容
[root@Centos8-template ~]# vim /etc/sysconfig/clock
ZONE="Etc/UTC"
2.生成鏈接
[root@Centos8-template ~]# ln -sf /usr/share/zoneinfo/UTC /etc/localtime
3. 查看時間。
[root@Centos8-template ~]# date
4.設置硬件時間和系統時間一致並校准
/sbin/hwclock --systohc
5.修改時間為shanghai,選擇Asia/Shanghai
ubuntu下載如下
root@ks-master01-10:~# dpkg-reconfigure tzdata
Current default time zone: 'Asia/Shanghai'
Local time is now: Tue Aug 9 14:52:55 CST 2022.
Universal Time is now: Tue Aug 9 06:52:55 UTC 2022.
root@ks-master01-10:~#
root@ks-master01-10:~#
root@ks-master01-10:~# date
Tue Aug 9 14:52:59 CST 2022