关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

ubuntu系统时间不正确的解决方法

发布时间:2024-08-09 15:58:55

本文介绍解决Ubuntu系统时间不正确的方法。ubuntu系统时候不对,一般很可能是时区不对,比如:我们是属于东八区,所以最后应该是:+0800。如果不是,就说明我们的时区不对。也有可能是时区正确,但系统时间不对,这时候需要安装ntpdate,然后同步时间。


1、系统时间查看


输入:date


输出:2024年 06月 05日 星期三 09:21:47 +06


备注:比电脑时间慢了两个小时;


2、查看系统时区


输入:timedatectl


输出:


Local time: 三 2024-06-05 09:23:44 +06


Universal time: 三 2024-06-05 03:23:44 UTC


RTC time: 三 2024-06-05 03:23:44


Time zone: Asia/Urumqi (+06, +0600)


Network time on: yes


NTP synchronized: yes


RTC in local TZ: no


备注:由输出可知,时区是Asia/Urumqi,时区不对;


3、修改系统时区


输入:sudo timedatectl set-timezone Asia/Shanghai


输出:


4、再次查看系统时区


输入:timedatectl


输出:


Local time: 三 2024-06-05 11:25:44 CST


Universal time: 三 2024-06-05 03:25:44 UTC


RTC time: 三 2024-06-05 03:25:44


Time zone: Asia/Shanghai (CST, +0800)


Network time on: yes


NTP synchronized: yes


RTC in local TZ: no


备注:由输出可知,时区修改为Asia/Shanghai;


5、安装ntpdate


输入:sudo apt-get install ntpdate


6、同步时间


输入:sudo ntpdate cn.pool.ntp.org


7、再次查看系统时间


输入:date


输出:2024年 06月 05日 星期三 11:26:19 CST




/template/Home/ZdsjuAE/PC/Static