本文小编为大家详细介绍“Centos7中怎么安装NTP网络时间协议”,内容详细,步骤清晰,细节处理妥当,希望这篇“Centos7中怎么安装NTP网络时间协议”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。

服务端:

1、安装ntp服务

yuminstallntpntpdate-y

2、查找当前地区,最适合的时间服务器

步骤一:打开网站:http://www.pool.ntp.org/zone/asia 步骤二:复制自动推荐的最合适的同步服务器

3、编辑 /etc/ntp.conf

vim /etc/ntp.conf 复制上述查到的时间服务器,保存

4、启动ntp服务

cd/usr/lib/systemd/systemsystemctlstartntpd#启动systemctlenablentpd.service#设置开机启动服务

5、同步远程时间服务(下面两个是第2步查询到的前两个ntp)

ntpdate-q0.asia.pool.ntp.org1.asia.pool.ntp.org

6、验证服务:ntpq -p

查看当前时间:date-R

打开百度,搜索“时间”,对比时间是否一致

7、建立Job,每天定时自动同步远程服务

crontab-e0001***root/usr/sbin/ntpdate-q0.asia.pool.ntp.org1.asia.pool.ntp.org客户端:

1、安装ntp服务

yuminstallntpntpdate-y

2、启动ntp服务

cd/usr/lib/systemd/systemsystemctlstartntpd#启动systemctlenablentpd.service#设置开机启动服务

3、修改硬件时间,保持和软件NTP时间同步

hwclock-w

4、测试服务器同步

ntpdate-d-b192.168.85.20

5、如果正常,即可建立Job,自动运行

0001***root/usr/sbin/ntpdate-q192.168.85.20

读到这里,这篇“Centos7中怎么安装NTP网络时间协议”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。