【转载】Linux升级NTPD服务器-编译安装ntp-4.2.8p12与配置
【转载】Linux升级NTPD服务器-编译安装ntp-4.2.8p12与配置
1. 系统与软件版本
1.1 系统版本
rhel6.4(Red Hat Enterprise Linux Server release 6.4 (Santiago))
1.2 ntpd软件版本
ntp-4.2.8p12.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 安装依赖包
# 特别注意:先用命令rpm -qa | grep "gcc/gcc-c++/openssl-devel/ libstdc++* /libcap*"查看本系统是否已经安装有这些软件包,有的话就不需要再次安装!
[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
[root@ntpserver ntp-4.2.8p9]# make && make install
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 # 这里以自己为ntpserver测试
fudge 127.127.1.0 stratum 10
下面是实际生产中的例子:

启动/重启ntpd服务
[root@ntpserver ~]# service ntpd start/restart
检查ntp服务是否开机启动,将其设置为开机启动。
[root@localhost ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost ~]# runlevel
N 3
[root@localhost ~]# chkconfig ntpd on #在运行级别2、3、4、5上设置为自动运行
[root@localhost ~]# chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# 最后查看ntpd的版本,重启系统,验证服务:


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 ~]# dat
Thu Dec 15 15:28:41 CST 2016
Windows客户端配置



【转载】Linux升级NTPD服务器-编译安装ntp-4.2.8p12与配置的更多相关文章
- Linux下指定版本编译安装LAMP
说明: 操作系统:CentOS 6.5 64位 需求: 编译安装LAMP运行环境 各软件版本如下: MySQL:mysql-5.1.73 Apache:httpd-2.2.31 PHP:php-5.2 ...
- Linux 从源码编译安装 OpenSSH
https://blog.csdn.net/bytxl/article/details/46639073 Linux 从源码编译安装 OpenSSH以及各问题解决 2015年06月25日 17:37: ...
- Linux 从源码编译安装 Nginx
Nginx 是一个高性能的 HTTP 和 反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器.Nginx 编译安装比较简单,难点在于配置.下面是 Nignx 0.8.54 编译安装和简 ...
- PCL库在Linux环境下的编译安装
PCL库在Linux环境下的编译安装 PCL库的源码库:https://github.com/PointCloudLibrary/pcl 下载完了之后解压下来 编译库的几个步骤 mkdir build ...
- linux下源码编译安装mysql
1.安装依赖的包: yum install -y gdb cmake ncurses-devel bison bison-devel 2.创建mysql安装目录和数据文件目录 mkdir -p /us ...
- 2020ubuntu1804server编译安装redis5笔记(二)配置redis
前一篇笔记记录了ubuntu1804server编译安装redis5,接下来要配置redis5了 网址:https://www.cnblogs.com/qumogu/p/12435694.html 第 ...
- linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本
红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...
- Linux 下源码编译安装 vim 8.1
前言 目前 linux 的各个发行版基本上都是带了一个 vi 编辑器的,而本文要说的 vim 编辑器对 vi 做了一些优化升级,更好用.当我们需要远程操作一台 linux 服务器的时候,只能使用命令行 ...
- 在Linux下源码编译安装GreatSQL/MySQL
欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 本 ...
随机推荐
- [SHOI2015]脑洞治疗仪(恶心的线段树,区间最大子段和)
题目描述: 曾经发明了自动刷题机的发明家 SHTSC 又公开了他的新发明:脑洞治疗仪--一种可以治疗他因为发明而日益增大的脑洞的神秘装置. 为了简单起见,我们将大脑视作一个 01 序列.11代表这个位 ...
- mybatis <fireach> 拼接sql语句 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'in'. Cause:
<select id="getUserIn" parameterType="QueryVo" resultMap="userMap"& ...
- 蓝图(Blueprint)详解
Blueprint 模块化 随着flask程序越来越复杂,我们需要对程序进行模块化的处理,针对一个简单的flask程序进行模块化处理 举例来说: 我们有一个博客程序,前台界面需要的路由为:首页,列表, ...
- 关于J2EE里面getContextPath()和getRealPath()的区别
一直老搞不清楚这两个方法的区别,只知道他们都是拿来获取地址的.今天特意写了个小demo试了一下,代码如下: @Override protected void service(HttpServletRe ...
- Linux分享笔记:shell终端的介绍
[1] Linux中 “shell终端” 和 “bash解释器” 的区别 shell终端是通过基于系统调用接口开发出的程序,用来让用户与系统进行对话,管理计Linux系统.它是一个命令行工具,操作类似 ...
- 模块importlib介绍
importlib包的目的是双重的.一个是在Python源代码中提供import语句(以及扩展名为__import__()函数)的实现.这提供了可以移植到任何Python解释器的import的实现.这 ...
- webpack 之 webpack-dev-server自动刷新
watch 首先介绍watch选项,参考这里.可实现相关源文件改变后自动更新bundle.js文件的功能.在配置文件中添加 watch:true 或执行 webpack -w,即可开启watch功能: ...
- 关于Ext.js和Ext.Net的杂谈
最近几年比较火的前端js框架extjs 算是其中的佼佼者.统一的UI设计,强悍的组件及丰富的插件,对浏览器良好的兼容性等优点使得许多公司使用Extjs,同时也使得无数程序猿开始研究这个玩意也包括我在内 ...
- 初识python 面向对象
what the f**k!!这个知识点学不好的最大元凶就是,我还单身??? python基础(四): 面向对象的三个特点: 封装,继承,多态 类: 对象是面向对象编程的核心,在使用对象的过程中,为了 ...
- MariaDB数据库服务
一.初始化mariaDB服务程序: yum install mariadb mariadb-server //安装mariaDB systemctl start mariadb ...