在虚拟机中同步网络时间(单机)
1.同步时间需要用到ntpdate服务,虚拟机没有的就简单安装一下:
[root@localhost ~]# yum install -y ntpdate
2.安装完之后,同步服务器时间与虚拟机时间:
[root@localhost ~]# ntpdate time.nist.gov
3.尝试启动一下ntpdate服务
[root@localhost ~]# service ntpdate start
4.ntpdate服务启动后,输入命令date,发现时间已经同步
[root@localhost ~]# date
5.最后一步,把系统时间同步到硬件,防止系统重启后时间恢复:
[root@localhost ~]# hwclock -w
[root@localhost ~]# hwclock