方法一、选择时区

执行命令,选择时区

$sudo dpkg-reconfigure tzdata

选择Asia->Shanghai
虚拟机 中Ubuntu同步时间虚拟机 中Ubuntu同步时间

防止系统重启后时区改变,执行下面一行命令

$sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -r

方法二、同步网上时间

1.安装ntpdate工具

$ sudo apt-get install ntpdate

虚拟机 中Ubuntu同步时间
2.设置系统时间与网络时间同步

$sudo ntpdate cn.pool.ntp.org

虚拟机 中Ubuntu同步时间
【注】cn.pool.ntp.org是位于中国的公共NTP服务器
3. 将系统时间写入硬件时间 # hwclock --systohc

$sudo hwclock --localtime --systohc

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
  • 2021-11-01
  • 2021-04-09
  • 2021-08-21
  • 2021-05-07
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-01
  • 2021-05-12
  • 2021-05-27
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
相关资源
相似解决方案