ntp服务的安装与配置:

安装ntp服务的过程比较简单首先你需要挂载光盘然后安装ntp服务如果配置了本地yum源可以直接使用光盘中的资源进行本地yum的安装,如果没有就使用rpm包进行安装。

由于我已经配置好了本地yum源所以我就直接使用本地yum源进行ntp服务的安装。

第一步使用yum命令安装ntp

yum install ntp -y

这里的 -y是一直确定的参数  如果不-y那么在安装的过程中每安装一个包就需要你确定一次那样会出现很繁琐的操作。

安装完成之后我们对ntp服务进行配置,配置文在:

/etc/ntp.conf

使用vi或者vim命令打开ntp.conf

# For more information about this file, see the man pages
# ntp.conf(), ntp_acc(), ntp_auth(), ntp_clock(), ntp_misc(), ntp_mon(). driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap nopeer noquery
restrict - default kod nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict - :: # Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst


#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client # Enable public key cryptography.
#crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
-- 插入 --

我们需要把这几行使用#全部注释掉

server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst

然后添加一条新的条件

   server xx.xx.xx.xx iburst
#server .centos.pool.ntp.org iburst
#erver .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst

使用server IP  iburst 之后你就能从时间同步服务器里同步自己本地的时间了

如过你要做为服务器的话 你可以在刚才那个位置添加 server 127.127.1.1  然后保存   并且重启ntpd服务就行了。

linux菜鸟日记(2)的更多相关文章

  1. linux菜鸟日记(5)

    iptables详细语法及配置: SNAT:源地址转换DNAT:目标地址转换PNAT:端口地址转换 ----------------------------------iptables规则链 路由以后 ...

  2. linux菜鸟日记(4)

    使用一个简单的for循环和if判断语句实现某个网段内所有ping所有客户机的shell程序: ..} do >&; then echo " ${i}通" else e ...

  3. linux菜鸟日记(3)

    Centos7利用shell编辑一串 一键完成一些基础配置的代码: 在这串shell代码中我实现了  IP地址的配置.光盘的挂载.本地yum源的搭建.一些服务的安装例如 httpd. php. ntp ...

  4. linux菜鸟日记

    本地yum源的安装: 要安装本地yum源,首先需要熟悉本地yum文件的配置和光盘的挂载 第一步挂载光盘: 首先需要指定一个光盘挂载目录 通常情况下我习惯使用默认挂载目录,所以一般我使用的光盘挂载命令是 ...

  5. Linux学习日记-使用EF6 Code First(四)

    一.在linux上使用EF 开发环境 VS2013+mono 3.10.0 +EF 6.1.0 先检测一下EF是不是6的 如果不是  请参阅 Linux学习日记-EF6的安装升级(三) 由于我的数据库 ...

  6. Linux管理日记(二)

    14  启动内网端口转发 ### 2. 查看IP以及网卡信息 # 可以发现, eth0 的地址 inet addr:10.144.7.195, 此为内网网卡 # 公网网卡, eth1 的地址 inet ...

  7. Linux菜鸟成长日记 ( Linux 下的 ftp 文件传输协议 )

    https://blog.csdn.net/buster_zr/article/details/80244542 FTP FTP 是 File Transfer Protocol (文件传输协议)的英 ...

  8. Linux 学习日记 1

    这是我第一次系统地学习Linux,希望通过这个学习日记收获一些东西把-- @_@ Grub - 启动管理器   在启动时让用户选择要启动的系统.(但是windows比较霸道--重装windows后会将 ...

  9. Linux学习日记——源码编译Apache

    [本文为笔者在学习Linux 下的软件安装时,尝试使用源码安装Apache 的过程,事后进行一个小小的总结,发现错误望指正.] 一.典型的源码编译安装软件的过程包括以下3步: 1) 运行 config ...

随机推荐

  1. CNN车型分类总结

    最近在做一个CNN车型分类的任务,首先先简要介绍一下这个任务. 总共30个类,训练集图片为车型图片,类似监控拍摄的车型图片,训练集测试集安6:4分,训练集有22302份数据,测试集有14893份数据. ...

  2. 【Android自学日记】【转】Android Fragment 真正的完全解析(下)

    上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和各种API,如果你还不了解,请看:Android Fragment 真正的完全解析(上). 本篇将介绍上篇博客提到的:如何管理Frag ...

  3. 解决VS2015安装后stdio.h ucrtd.lib等文件无法识别问题

    今天突然想在windows上装个 VS2015 玩玩,结果遇到了如下bug:安装完 VS2015 后,直接新建项目->win32控制台->运行,结果报错!"无法打开包括文件: & ...

  4. 我的攒机(zuosi)过程

    先贴上自己的配置清单: CPU E3 1240V2 930 https://item.taobao.com/item.htm?spm=a230r.1.14.8.lds6QF&id=532971 ...

  5. git 实用技巧

    一.git 常用操作 1.1 // 该方法会显示某次提交的所有更改 git log --pretty=oneline 文件名 git show 356f6def9d3fb7f3b9032ff5aa4b ...

  6. erlang 虚机CPU 占用高排查

    -问题起因 近期线上一组服务中,个别节点服务器CPU使用率很低,只有其他1/4.排除业务不均,曾怀疑是系统top统计错误,从Erlang调度器的利用率调查 找到通过erlang:statistics( ...

  7. jdbcTemplate批量插入(添加)

    public void addSubscibe(List<PermedipUserSubscribeVo> list) { final List<PermedipUserSubscr ...

  8. PowerDesigner通过SQL语句生成PDM文件

    前提: 我用的是PowerDesigner15 数据库为Mysql5.5 步骤如下: 第一步:File->New Model 点击OK创建模板就行了 备注:在创建物理模型时DBMS下拉框是空的, ...

  9. 使用野狗(Wilddog)云setValue写入数据

    - (void)viewDidLoad { [super viewDidLoad]; //创建野狗实例化对象 用于随时监听数值变化 Wilddog *myRootRef = [[Wilddog all ...

  10. 如何下架app

    因赶数日工期成,偷得浮生半日闲.遂登录iTunes Connect,发现之前做过的小程序,想将其下架,故而有此篇随想.(温馨提示:项目被下架后再次上架该版本,不需要再次经过审核)下面是详情步骤: 1. ...