安装ntpdate服务,更新系统时间,使之与网络时间同步
1、第一步:安装ntpdate服务
[root@oldboyedu~]#/usr/sbin/ntpdate ntpl.aliyun.com //检查是否可以执行,发现不能,因为没有安装ntpdate服务
-bash:/usr/sbin/ntpdate:No such file or directory
[root@oldboyedu~] which ntpdate //查询ntpdate命令路径,可跳过此步
/usr/bin/which:no ntpdate in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/b
[root@oldboyedu~] yum provides ntpdate //查询ntpdate依赖的包
Loaded plugins:fastestmirror Loading mirror speeds from cached hostfile
ntpdate-4. 2. 6p5-28el7 centos x86 64:Utility to set the date and time via NT
Repo base
[root@oldboyedu~]yum install ntpdate -y //安装ntpdate包
2、第二步:
①[root@oldboyedu~]/usr/sbin/ntpdate ntp1.aliyun.com
② #执行命令date
,系统时间更新完成。
[root@oldboyedu~]date