1. 系统与软件版本

1.1 系统版本

CentOS6.5 x86_64

1.2 ntpd软件版本

ntp-4.2.8p9.tar.gz

1.3 下载地址

官方下载地址:http://support.ntp.org/bin/view/Main/SoftwareDownloads

参考文档:http://www.linuxfromscratch.org/blfs/view/svn/basicnet/ntp.html

2. 安装前提

2.1 安装依赖包

[root@ntpserver ~]# yum install gcc gcc-c++ openssl-devel libstdc++* libcap*

2.2 备份旧版本的配置文件

[root@ntpserver ~]# cp -ar /etc/ntp /etc/ntp.bak
[root@ntpserver ~]# cp /etc/ntp.conf /etc/ntp.conf.bak
[root@ntpserver ~]# cp /etc/init.d/ntpd /etc/init.d/ntpd.bak
[root@ntpserver ~]# cp /etc/sysconfig/ntpd /etc/sysconfig/ntpd.bak
[root@ntpserver ~]# cp /etc/sysconfig/ntpdate /etc/sysconfig/ntpdate.bak

2.3 卸载yum安装的ntpd服务

[root@ntpserver ~]# yum erase ntp ntpdate

3. 编译安装ntp-4.2.8p9

3.1 创建/var/lib/ntp目录

[root@ntpserver ~]# install -v -m710 -o ntp -g ntp -d /var/lib/ntp

3.2 编译安装ntpd

[root@ntpserver ntp-4.2.8p9]# ./configure --prefix=/usr --bindir=/usr/sbin --sysconfdir=/etc --enable-linuxcaps --with-lineeditlibs=readline --docdir=/usr/share/doc/ntp-4.2.8p9 --enable-all-clocks --enable-parse-clocks --enable-clockctl
 
make && make install
[root@ntpserver ~]# ntp
ntpd        ntpdate     ntpdc       ntp-keygen  ntpq        ntptime     ntptrace    ntp-wait

4. 创建配置文件

[root@ntpserver ~]# cp /etc/init.d/ntpd.bak /etc/init.d/ntpd
[root@ntpserver ~]# cp /etc/sysconfig/ntpd.bak /etc/sysconfig/ntpd
[root@ntpserver ~]# cp /etc/sysconfig/ntpdate.bak /etc/sysconfig/ntpdate
[root@ntpserver ~]# mv /etc/ntp.bak /etc/ntp
[root@ntpserver ~]# cp /etc/ntp.conf.bak /etc/ntp.conf

5. 配置ntp.conf

在/etc/ntp.conf配置文件添加以下参数

server 127.127.1.0

fudge 127.127.1.0 stratum 10

启动ntpd服务

[root@ntpserver ~]# service ntpd start

6. 客户端配置

[root@localhost ~]# date
Sat Aug  8 08:08:13 CST 2015

/etc/ntp.conf添加服务端IP地址

server 10.17.83.106

[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 10.17.83.106    10.17.82.25     12 u    3   64    1    0.628  4279381   0.001

等待几分钟,ntpd客户端自动去同步服务端的时间

[root@localhost ~]# date
Sat Aug  8 08:11:10 CST 2015
[root@localhost ~]# date
Thu Dec 15 15:28:41 CST 2016

最新文章

  1. 【原创】Chrome最新版(53-55)再次爆出BUG!
  2. arm,iptables: No chain/target/match by that name.
  3. linux驱动中printk的使用注意事项
  4. Ubuntu系统下Xen虚拟机的基本安装方法(代码创建)
  5. 【LeetCode】389 Find the Difference(java)
  6. 阅读廖雪峰老师git教程笔记
  7. codeforces Gym 100187J J. Deck Shuffling dfs
  8. android style 退出动画 解决退出动画无效问题
  9. Java中怎么控制线程訪问资源的数量
  10. while循环与i--
  11. ES1:Windows下安装ElasticSearch
  12. Scala:函数和闭包
  13. 解决VS2019中.net core WPF 暂时无法使用 Designer 的临时方法
  14. NOIP2012提高组day2 T2借教室
  15. UOJ275 [清华集训2016] 组合数问题 【Lucas定理】【数位DP】
  16. jquery开发插件提供的几种方法
  17. 配置Server.xml
  18. 制作MACOSX10.10.3/10.9安装启动盘U盘的教程
  19. 再有人问你synchronized是什么,就把这篇文章发给他
  20. 未能找到类型集或命名空间名称 "xxxxxx" (是否缺少using 指令或引用?)

热门文章

  1. OpenCV249 for python278 最简配置方案
  2. Entity Framework 之 Code First
  3. 调试PostSharp DEMO 遇到的问题
  4. linux 网络编程:客户端与服务器通过TCP协议相互通信 + UDP
  5. Eclipse 4.3正式版发布
  6. java字节码指令集
  7. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第五章:排序、分页和路由
  8. 【汇编语言】DEBUG的使用
  9. MySQL索引方法
  10. java类构造器的理解