在 CentOS 系统中,时间戳同步通常是通过 NTP(网络时间协议)服务来实现的。以下是同步 CentOS 系统时间戳的步骤:
sudo yum install ntp
sudo systemctl start ntpd
sudo systemctl enable ntpd
sudo systemctl status ntpd
sudo ntpdate pool.ntp.org
这里,pool.ntp.org 是一个公共 NTP 服务器池,你可以根据需要替换为其他 NTP 服务器地址。
/etc/ntp.conf 文件,添加或修改以下内容:server pool.ntp.org iburst
然后重启 NTP 服务:
sudo systemctl restart ntpd
现在,你的 CentOS 系统应该已经成功同步了时间戳。你可以使用 date 命令查看当前系统时间:
date
请注意,如果你的 CentOS 系统位于内网环境中,可能需要配置内网的 NTP 服务器来进行时间同步。在这种情况下,你可以将 /etc/ntp.conf 文件中的 pool.ntp.org 替换为内网 NTP 服务器的地址。