CentOS 8时间同步(ntp)

Centos8的以前版本,时间同步需要yum安装ntp软件,然后执行/usr/sbin/ntpdate time.windows.com.cn /usr/sbin/ntpdate是同步命令,time.windows.com.cn时间服务器)命令,就能实现和互联网的时间服务器的时间一致。但是在Centos8中,yum install ntp时提示没有ntp安装软件。

ntpdate方法:

添加wlnmpyum源:

rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm

安装时间同步软件:

yum install wntp

测试:

date#显示当前的时间

date -s 2010/01/01#修改时间

date#显示修改后的当前时间

ntpdate ntp1.aliyun.com#同步时间

date#显示当前时间

image.png 

可以把时间同步加入到定时同步,保证系统时间实时和互联网的时间一致。


猜你喜欢

转载自blog.51cto.com/6300167/2484498