Centos6 编译安装局域网NTP服务器
一、条件及环境:
1、CentOS:我用的是最新的CentOS 6.5 64位版,此教程应该也适用于RedHat 6及CentOS 6系列所有系统;
2、编译所需环境:
1 |
# yum -y install vim ntp* wget gcc gcc-c++ ncurses-devel cmake make |
2 |
# cp /etc/ntp.conf /usr/local/src/ntp.conf |
3 |
# yum remove ntp* |
注意:编译安装不会在/etc下自动生成配置文件,所以我先yum安装ntp 4.2.6p5生成/etc/ntp.conf后复制出配置文件,再卸载ntp。
3、关闭防火墙及SELINUX!
1 |
# chkconfig iptables off |
2 |
# vim /etc/sysconfig/selinux |
3 |
将SELINUX=enforcing修改成: |
4 |
SELINUX=disabled |
二、下载并安装ntp 4.2.7p425:
1、下载ntp 4.2.7p425:
如果服务器可以上网,可直接用wget命令下载:
1 |
# cd /usr/local/src |
2 |
# wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-dev/ntp-dev-4.2.7p425.tar.gz |
如果服务器不能上网,那你就去http://www.ntp.org/downloads.html下载到本地,然后通过SFTP或FTP上传到服务器上!
2、解包安装ntp-dev-4.2.7p425.tar.gz:
1 |
# tar zxvf ntp-dev-4.2.7p425.tar.gz |
2 |
# cd ntp-dev-4.2.7p425 |
3 |
# ./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocks |
4 |
# make && make install |
3、修改配置文件ntp.conf:
1 |
# cp /usr/local/src/ntp.conf /etc/ntp.conf |
2 |
# vim /etc/ntp.conf |
第(1)种配置:允许任何IP的客户机都可以进行时间同步
则将“restrict default kod nomodify notrap nopeer noquery”这行修改成:
1 |
restrict default nomodify |
第(2)种配置:只允许192.168.200.*网段的客户机进行时间同步
在“restrict default kod nomodify notrap nopeer noquery”(表示默认拒绝所有IP的时间同步)之后增加一行:
restrict 192.168.200.0 mask 255.255.255.0 nomodify
另外,配置文件默认通过网络同步时间:
1 |
server 0.centos.pool.ntp.org iburst |
2 |
server 1.centos.pool.ntp.org iburst |
3 |
server 2.centos.pool.ntp.org iburst |
4 |
server 3.centos.pool.ntp.org iburst |
(RedHat默认有类似上面4行内容,域名不一样而已)
如果需要使用本地时间,则把上面4行删掉或者用“#”号注释掉,然后添加以下两行:
1 |
server 127.127.1.0 |
2 |
fudge 127.127.1.0 stratum 10 |
(RedHat默认有上面两行,但被注释掉了)
4、启动ntp服务:
1 |
# /usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid |
2 |
# 检查ntp服务器是否在后台运行可以用下面这条命令: |
3 |
# ps -ef | grep ntp |
4 |
# 检查ntpd侦听的UDP 123端口是否正常用下面这条命令: |
5 |
# netstat -unl | grep 123 |
5、用客户端检验时钟同步服务器是否可用。
6、如需设置ntpd服务开机自动启动,则只需把上面的启动命令放入/etc/rc.local文件中即可。
Centos6 编译安装局域网NTP服务器的更多相关文章
- centos6.7搭建局域网ntp服务器
修改/etc/ntp.conf文件 restrict xxx nomodify notrap nopeer noquery #xxx 此处配置本地IP地址restrict 12 ...
- 配置树莓派3和局域网NTP服务器实现内网时间校准
一.配置局域网NTP服务器 1.安装ntp-4.2.8p5-win32-setup.exe 下载地址:https://www.meinbergglobal.com/english/sw/ntp.htm ...
- centos6.4安装配置vpn服务器步骤详解
centos6.4安装配置vpn服务器步骤详解,从安装VPN到配置VPN服务器.配置VPN服务器的路由转发功能,每一步都很详细 一.VPN服务器环境说明 操作系统:CentOS release ...
- 在centos6编译安装http-2.4
在centos6 编译安装httpd-2.4 安装httpd-2.4 Ü 依赖于apr-1.4+, apr-util-1.4+, [apr-iconv] Ü apr: : apache portabl ...
- CentOS6编译安装php5.3
一.CentOS6编译安装php5.3 1.安装扩展 yum install -y openssl-devel traceroute libtool unzip gcc gcc-c++ autocon ...
- MAC 上编译安装nginx-rtmp-module 流媒体服务器
MAC 上编译安装nginx-rtmp-module 流媒体服务器 记录踩坑过程 下载nginx和nginx-rtmp-module wget http://nginx.org/download/ng ...
- CentOS6编译安装PHP7+Nginx
本文属于动手搭建PHP开发环境的一部分,更多点击链接查看. 本文以centos6为例. 安装PHP 下载 http://cn2.php.net/distributions/php-5.6.22.tar ...
- Centos7安装搭建NTP服务器和NTP客户端同步时间
NTP简介: NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议. 在计算机的世界里,时间非常地重要 例如:对于火箭发射这种科研活动,对时间的 ...
- Linux.Centos6编译安装nginx
环境 系统环境:CentOS release 6.7 (Final) 需求 centos6.7编译安装nginx1.x 准备 安装依赖 yum install -y gcc gcc-c++ autoc ...
随机推荐
- mysqli扩展库操作mysql数据库
配置环境 配置php.ini文件让php支持mysqli扩展库 extension=php_mysqli.dll 建库建表 详见博客 “mysql扩展库操作mysql数据库” 查询数据库 <?p ...
- js 获取时间 new Date()详细介绍
javaScript系列:js中获取时间new Date()详细介绍 (2012-03-31 09:54:25) 转载▼ 标签: js时间 new date() 字符类型 转换 分类: study-j ...
- 定位 - CoreLocation - 区域报警
#import "ViewController.h" #import <CoreLocation/CoreLocation.h> @interface ViewCont ...
- php常用函数集
网络请求: /** * 发起HTTPS请求 */ function curl_post($url,$data=null,$header=null,$post=0) { //初始化curl $ch = ...
- 第 1 章 策略模式【Strategy Pattern】
第 1 章 策略模式[Strategy Pattern] 以下内容出自: 24种设计模式介绍与6大设计原则.pdf 刘备要到江东娶老婆了,走之前诸葛亮给赵云(伴郎)三个锦囊妙计,说是按天机拆开解决棘手 ...
- PS仿制图章
颜色总不对,和周围不太搭配,这时候把流量调小点,然后用渐变工具.自己实践所得.
- 【技术贴】三星Note8 N5100实用教程,关闭相机快门声,增加浏览器退出按钮。
需要root 增加快门声按钮: 在\system\csc\目录下,有个others.xml的手机功能定制文件,用root explorer之类可以修改系统文件权限的文本修改工具编辑它,在文件最末添加这 ...
- SPRING IN ACTION 第4版笔记-第三章Advancing wiring-001-DataSource在应用和开发环境之间切换 profile
一. DataSource在应用和开发环境的产生方式不同,可以用srping 的profile管理 Spring’s solution for environment-specific beans i ...
- Seattle(65) lypzxy的博客
http://www.cnblogs.com/cb168/tag/Firemonkey/
- 在android4.0中实现View的拖动效果
实现方法: 首先需要定义一个支持拖动的源组件和一个作为Drop区域的目标组件. 在支持拖动的组件中注册OnTouchListener 或LongClickListener监听事件,构建一个ClipDa ...