问题描述:
1.基于vmware创建的服务器 时区不准确需要修改为自己所在的时区
2.需要调整时间为24小时制(默认的为am pm)
3.硬件vmware的时间不准确导致硬件时间不准确的调整
1.查看时区
root@wadequ-ThinkPad-L13:/opt/asmagent/bin# timedatectl
Local time: 三 2023-12-20 10:57:10 CST
Universal time: 三 2023-12-20 02:57:10 UTC
RTC time: 三 2023-12-20 02:57:10
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
2.修改时区
//法1
timedatectl set-timezone Asia/Shanghai //设置新的时区为上海
//法二
通过tzselect 命令设置
3.设置时间为24小时制
vim /etc/default/locale
root@wadequ-ThinkPad-L13:/opt/asmagent/bin# cat /etc/default/locale
LANG=zh_CN.UTF-8
LC_TIME=en_DK.UTF-8
4.同步时间到硬件
//可链接外网的配置
sudo apt install ntpdate
ntpdate pool.ntp.org //同步时间
//无法链接外网设置
date -s "2023-12-20 22:30:00"
//将时间写入硬件
hwclock -w
//查看硬件时间
hwclock --show