Debian系统可通过NTP(网络时间协议)或Chrony服务同步时间戳,以下是具体方法:
sudo apt-get update
sudo apt-get install ntp
/etc/ntp.conf,添加公共服务器(如 pool.ntp.org)或局域网服务器:sudo nano /etc/ntp.conf
# 示例:添加公共服务器
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
sudo systemctl restart ntp
sudo systemctl enable ntp # 设置开机自启
# 检查同步状态
ntpq -p # 查看NTP服务器连接和同步偏差
sudo apt-get update
sudo apt-get install chrony
sudo systemctl start chrony
sudo systemctl enable chrony
chronyc tracking # 查看同步状态
若需立即同步,可使用 ntpdate(需先安装):
sudo apt-get install ntpdate
sudo ntpdate pool.ntp.org # 替换为实际服务器地址
hwclock 命令)。以上方法可确保Debian系统时间戳与网络时间源同步。