Debian/Ubuntu/Raspbian 时间同步

本文介绍如何在Linux系统中设置正确的时区为中国时区,并通过ntpdate命令同步时间到上海交通大学的时间服务器,确保系统时间准确无误。

时区设置

先使用如下命令查看自己系统设置的时区

date -R

如果输出的不是+8000,那么需要调整时区:

dpkg-reconfigure tzdata

选择asia,中国的城市即可。

调整时间

apt-get install ntpdate
ntpdate ntp.sjtu.edu.cn

然后再次运行:

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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值