虚拟机或服务器同步网络时间

提要:自己安装的虚拟机或手动安装的linux系统,在安装完成后要确定虚拟机或服务器上的时间和网络时间是否同步。

    1. 使用date命令查看虚拟机上或服务器上的时间是否正确
    2. 将上海的时间作为参考:
      cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    3. 同步网络时间,这时需要用到ntpdate工具
      (1) 安装
      yum install -y ntpdate
      (2) 同步
      ntpdate time.nist.gov
    4. 执行date命令确认同步成功
    5. 把系统时间同步到硬件,防止系统重启后时间恢复
      hwclock -w
    6. 重启虚拟机执行date命令

猜你喜欢

转载自www.cnblogs.com/lty-fly/p/12768698.html
今日推荐