校正Ubuntu时间为北京时间

本文介绍了一种简单的方法来解决Ubuntu系统时间与北京时间相差8小时的问题。通过使用tzselect命令选择Asia/Shanghai时区,并更新本地时间配置,使Ubuntu系统时间同步至东八区标准时间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一般情况下,Ubuntu时间与实际时间相差8小时,因为他的时区设置为0时区,而我们想让他为北京时间。
校正方法如下:
1.运行tzselect,选择Asia(亚洲)
在这里插入图片描述
2.选择China,然后选定北京时间
在这里插入图片描述

在这里插入图片描述
3.复制文件到本地时间内

sudo cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

在这里插入图片描述
现在再用date命令时,就能发现已经是东八区标准时间了

//home/pi/pijiaYOLO/piPython/pythonyilai $ sudo apt update Get:1 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm InRelease [151 kB] Get:2 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-updates InRelease [55.4 kB] Get:3 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm-backports InRelease [59.4 kB] Get:4 https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security InRelease [48.0 kB] Get:5 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/main arm64 Packages [8,693 kB] Get:6 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/main armhf Packages [8,508 kB] Get:7 http://archive.raspberrypi.com/debian bookworm InRelease [55.0 kB] Get:8 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/main Translation-en [6,109 kB] Get:9 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/contrib armhf Packages [42.9 kB] Get:10 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/contrib arm64 Packages [45.7 kB] Get:11 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/contrib Translation-en [48.4 kB] Get:12 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/non-free armhf Packages [55.9 kB] Get:13 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/non-free arm64 Packages [75.8 kB] Get:14 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/non-free Translation-en [68.1 kB] Get:15 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/non-free-firmware armhf Packages [5,480 B] Get:16 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/non-free-firmware arm64 Packages [5,832 B] Get:17 https://mirrors.tuna.tsinghua.edu.cn/debian bookworm/non-free-firmware Translation-en [20.9 kB] Reading package lists... Done E: Release file for https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bookworm-updates/InRelease is not valid yet (invalid for another 11d 22h 58min 46s). Updates for this repository will not be applied. E: Release file for https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bookworm-backports/InRelease is not valid yet (invalid for another 11d 22h 58min 46s). Updates for this repository will not be applied. E: Release file for https://mirrors.tuna.tsinghua.edu.cn/debian-security/dists/bookworm-security/InRelease is not valid yet (invalid for another 11d 20h 52min 47s). Updates for this repository will not be applied. E: Release file for http://archive.raspberrypi.com/debian/dists/bookworm/InRelease is not valid yet (invalid for another 11d 21h 21min 27s). Updates for this repository will not be applied.
最新发布
07-18
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值