centos7 中如何同步时间
001、查看时区
[root@PC1 bin]# timedatectl status|grep 'Time zone' Time zone: Asia/Shanghai (CST, +0800)
002、查看当前时间
[root@PC1 bin]# date Mon May 22 01:15:22 CST 2023
003、安装 ntpdate
[root@PC1 bin]# yum -y install ntpdate
004、更新时间
[root@PC1 bin]# ntpdate -u pool.ntp.org 21 May 22:46:12 ntpdate[65354]: adjust time server 202.118.1.81 offset 0.027530 sec
005、查看时间
[root@PC1 bin]# date Sun May 21 22:47:07 CST 2023
备选:
001、
[root@PC1 bin]# yum install rdate
002、更新时间
[root@PC1 bin]# rdate -s time.nist.gov
003、查看时间
[root@PC1 bin]# date Sun May 21 22:49:23 CST 2023