centos 7 NTP离线安装部署
<p>1.下载三个rpm离线包</p><p>ntpdate-4.2.6p5-29.el7.centos.2.x86_64</p>
<p>ntp-4.2.6p5-29.el7.centos.2.x86_64</p>
<p>autogen-libopts-5.18-5.el7.x86_64</p>
<p>地址:</p>
<p>http://mirror.centos.org/centos/7/os/x86_64/Packages/ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm</p>
<p>http://mirror.centos.org/centos/7/os/x86_64/Packages/ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm</p>
<p>http://mirror.centos.org/centos/7/os/x86_64/Packages/autogen-libopts-5.18-5.el7.x86_64.rpm</p>
<p> </p>
<p>2.上传至centos安装</p>
<p>ntp -ivh ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm</p>
<p>ntp -ivh ntp-4.2.6p5-29.el7.centos.2.x86_64</p>
<p>ntp -ivh autogen-libopts-5.18-5.el7.x86_64.rpm</p>
<p><img src="https://img2022.cnblogs.com/blog/811703/202204/811703-20220415155658262-1445265620.png"></p>
<p> </p>
<p> </p>
<p> 3.查看安转版本 rpm -q ntp</p>
<p><img src="https://img2022.cnblogs.com/blog/811703/202204/811703-20220415155901862-1512297820.png"></p>
<p> </p>
<p> </p>
<p> 4. 启用ntp服务 systemctl enable ntpd </p>
<p> <img src="https://img2022.cnblogs.com/blog/811703/202204/811703-20220415160005407-1350464481.png"></p>
<p> </p>
<p> </p>
<p> 5.开始ntp服务 systemctl start ntpd</p>
<p> 查看状态 systemctl status ntpd</p>
<p><img src="https://img2022.cnblogs.com/blog/811703/202204/811703-20220415160139272-501795829.png"></p>
<p> </p>
<p>6. 编辑master的机器的文件/etc/ntp.conf</p>
<div>
<div><em id="__mceDel"> 找到ntp时间同步的机器范围配置项<br>
restrict 192.168.3.0mask255.255.255.0nomodify notrap<br>
这里的意思代表,192.168.3的网段的机器都参与ntp的时间同步</em></div>
</div>
<div class="cnblogs_code">
<p># For more information about this file, see the man pages<br># ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).</p>
<p>driftfile /var/lib/ntp/drift</p>
<p># Permit time synchronization with our time source, but do not<br># permit the source to query or modify the service on this system.<br>restrict default nomodify notrap nopeer noquery</p>
<p># Permit all access over the loopback interface.This could<br># be tightened as well, but to do so would effect some of<br># the administrative functions.<br>restrict 127.0.0.1 <br>restrict ::1</p>
<p># Hosts on local network are less restricted.<br>restrict 192.168.111.0 mask 255.255.255.0 nomodify notrap</p>
<p># Use public servers from the pool.ntp.org project.<br># Please consider joining the pool (http://www.pool.ntp.org/join.html).<br>server ntp1.aliyun.com<br>server ntp2.aliyun.com<br>server ntp3.aliyun.com<br>server 127.0.0.1<br>fudge 127.0.0.1 stratum 10</p>
<p>#broadcast 192.168.1.255 autokey # broadcast server<br>#broadcastclient # broadcast client<br>#broadcast 224.0.1.1 autokey # multicast server<br>#multicastclient 224.0.1.1 # multicast client<br>#manycastserver 239.255.254.254 # manycast server<br>#manycastclient 239.255.254.254 autokey # manycast client</p>
<p># Enable public key cryptography.<br>#crypto</p>
<p>includefile /etc/ntp/crypto/pw</p>
<p># Key file containing the keys and key identifiers used when operating<br># with symmetric key cryptography. <br>keys /etc/ntp/keys</p>
<p># Specify the key identifiers which are trusted.<br>#trustedkey 4 8 42</p>
<p># Specify the key identifier to use with the ntpdc utility.<br>#requestkey 8</p>
<p># Specify the key identifier to use with the ntpq utility.<br>#controlkey 8</p>
<p># Enable writing of statistics records.<br>#statistics clockstats cryptostats loopstats peerstats</p>
<p># Disable the monitoring facility to prevent amplification attacks using ntpdc<br># monlist command when default restrict does not include the noquery flag. See<br># CVE-2013-5211 for more details.<br># Note: Monitoring will not be disabled with the limited restriction flag.<br>disable monitor</p>
</div>
<div>
<div>ntp.conf中有默认的时间服务器,我们需要注销,然后添加上我们对应的时区时间服务器。<br>
server ntp1.aliyun.com<br>
server ntp2.aliyun.com<br>
server ntp3.aliyun.com
<p> </p>
<p>///当以上三个时间服务器不可用时,就是以本机时间作为集群机器的统一时间。<br>
server 127.0.0.1<br>
fudge 127.0.0.1 stratum 10</p>
</div>
</div>
<p> <img src="https://img2022.cnblogs.com/blog/811703/202204/811703-20220415160542825-591940706.png"></p>
<p> </p>
<p> 6.更新时间 ntpdate -u ntp2.aliyun.com</p>
<p>7.配置客户机 /etc/ntp.conf </p>
<p>server 192.168.111.128</p>
<p>同步时间命令 ntpdate -u 192.168.111.128 需要关闭防火墙</p><br><br>
来源:https://www.cnblogs.com/jinpeigang/p/16149670.html
頁:
[1]