Ubuntu校时方法
校时方法
手动设置时间
检查系统时间
使用 date 命令检查系统时间
date
设定时区
使用 timedatectl 手动设定时区为上海
timedatectl set-timezone Asia/Shanghai
手动设定系统时间
使用 date 手动设定系统时间
date -s "2024-07-31 12:15:45"
回写硬件时间
将系统时间回写硬件时间
hwclock --systohc
Ubuntu 20.04 自动同步网络时间
启用 timedatectl 时间同步服务
timedatectl set-ntp true
修改 timedatectl 配置文件
# 在NTP=后增加NTP服务地址,用来进行时间同步
vim /etc/systemd/timesyncd.conf
Ubuntu 18.04 自动同步网络时间
启用 ntp 时间同步服务
systemctl start ntp
systemctl enable ntp
修改 ntp 配置文件
# 在server后添加NTP服务地址,用来进行时间同步
vim /etc/ntp.conf
Leave a comment