Linux 时间、时区不对

linux 校准时间、时区

目录

  校准时间 ntpdate

  校准时区

ntpdate 校准时间

1. ntpdate安装

sudo atp-get install ntpdate

2. 校准时间(注意:该阶段校准时间后,重启机器,时间再次不准,需要再次校准)

sudo ntpdate ntp.ubuntu.com
# or
sudo ntpdate time.nist.gov 
# or
sudo ntpdate time.windows.com

3. 将校准后的时间更新到硬件上(CMOS),重启后时间正常

sudo hwclock --localtime --systohc
# or
sudo hwclock --systohc

校准时区

设置设备的时区为上海

sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
# sudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 

  

 

posted @ 2021-11-17 17:07  zhuang6  阅读(789)  评论(0)    收藏  举报