ntp简易安装与时间同步

yum -y install ntp ntpdate    //安装ntp服务
ntpdate cn.pool.ntp.org //更新时间
hwclock --systohc //系统时钟和硬件时钟同步或者 clock --systohc
http://www.pool.ntp.org是NTP的官方网站,在这上面我们可以找到离我们国家的NTP Server cn.pool.ntp.org.它有3个服务器地址:
服务器一: 1.cn.pool.ntp.org
服务器二: 2.asia.pool.ntp.org
服务器三: 3.asia.pool.ntp.org
(直接用域名有时有问题,可以先Ping出他们的IP,然后用IP地址同步)

老师的方法

NTP的搭建
yum 库配置,这里配置本地镜像文件作为库,yum库的详细配置还是看看其他博客吧,我没有配置这个 [mnt]
name=mnt
baseurl=file:///mnt
gpgcheck=0
enabled=1 3.1服务端:
vim /etc/ntp.conf
把如下四行代码注释掉 server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst 在下面再添加一行 server 127.127.1.0 iburst //使本机成为服务器机,其他节点同步时间向本机获取时间,使各节点时间一致 启动ntp服务
systemctl start ntpd
systemctl enable ntpd 3.2客户端
vim /etc/ntp.conf #注释掉其他上游时间服务器
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#配置上游时间服务器为本地的ntpd Server服务器
server 192.168.0.163
#配置允许上游时间服务器主动修改本机的时间
restrict 192.168.0.163 nomodify notrap noquery 与本地ntpd Server同步一下
ntpdate -u 192.168.0.163
systemctl start ntpd [root@Slave1 yum.repos.d]# date -s '17:30:00' 修改时间
[root@Slave1 yum.repos.d]# clock -w 写硬件时钟 计划任务:
yum install crontabs (安装 crontabs)
systemctl enable crond (设为开机启动)
systemctl start crond(启动crond服务)
systemctl status crond (查看状态)
yum list installed |grep crontab
vi /etc/crontab crontab -u 用户名 -l (列出用户的定时任务列表 [root@slave1 ~]# crontab /etc/crontab
[root@slave1 ~]# crontab -l
tail -10000f /var/log/cron | grep ntpd

【Linux】ntp服务-时间同步的更多相关文章

  1. Linux NTP服务配置 for Oracle RAC

    安装Oracle 11g RAC时,我们需要配置ntp服务.在使用虚拟机的情况下对于时钟同步方式的配置有很多种方式,可以使用vmware自带的时钟同步功能,也可以直接将本地的一个节点用作时间服务器.本 ...

  2. 2-4-搭建DHCP服务实现动态分配IP地址-NTP网络时间同步

    本节所讲内容: •DHCP服务器工作原理 •使用DHCP为局域网中的机器分配IP地址 •使用DHCP为服务器分配固定IP地址 •ntpdate加计划任务同步服务器时间 ---------------- ...

  3. CentOS6 配置阿里云 NTP 服务

    本文以Centos 6.5为例介绍如何修改Linux实例时区,以及开启和配置Linux NTP服务,保证实例本地时间精确同步. 前提条件 NTP服务的通信端口为UDP 123,设置NTP服务之前请确保 ...

  4. 配置Windows实例NTP服务

    本文介绍如何开启和配置Windows NTP服务,保证实例本地时间精确同步. Windows实例NTP服务介绍 目前,所有地域下ECS实例默认采用CST(China Standard Time)时区, ...

  5. linux时间同步-NTP服务

    作者:曹世军链接:https://www.zhihu.com/question/30252609/answer/108840850来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  6. Linux ntp 时间同步服务配置

    一.基础环境 1.操作系统:CentOS 7.3 2.ntp:4.2.6 3.机器,服务端(192.168.1.210)客户端(192.168.1.211) 二.安装ntp yum -y instal ...

  7. 时间同步ntp服务的安装与配置(作为客户端的配置

    在linux环境下,我们不仅可以自己设置时间,也可以对系统进行时间的同步,比如同步时间到某台物理机上或虚拟机,皆可!接下来我们就以同步时间到某台物理机为例, 一起学习学习. 1.配置本地yum源(挂载 ...

  8. linux ntp时间同步

    linux ntp时间同步 一.搭建时间同步服务器1.编译安装ntp serverrpm -qa | grep ntp若没有找到,则说明没有安装ntp包,从光盘上找到ntp包,使用rpm -Uvh n ...

  9. NTP服务及时间同步(CentOS6.x)

    博客分类: linux   今有一小型项目,完全自主弄,原来以为很简单的NTP服务,我给折腾了2个多小时才整撑头(以前都是运维搞,没太注意,所以这技术的东西,在简单都需要亲尝啊),这里记录为以后别再浪 ...

随机推荐

  1. HC32F003C4PA GPIO Output

    1.打开启动文件,找到并跳转至SystemInit函数 void SystemInit(void) { stc_clk_systickcfg_t stcCfg; // TODO load trim f ...

  2. Quartus II 与modelsim连接不上的问题

    在Quartus II 中tools>options>General>EDA Tool Options 设置modelsim 路径 说明:不管是Quartus II 与modelsi ...

  3. [whu1568]dp优化

    http://acm.whu.edu.cn/land/problem/detail?problem_id=1568 思路:先将所有数分解,得到2,3,5,7的个数,转化为用这些2,3,5,7" ...

  4. 关于SpringBoot的外部化配置使用记录

    关于SpringBoot的外部化配置使用记录 声明: 若有任何纰漏.错误请不吝指出! 记录下使用SpringBoot配置时遇到的一些麻烦,虽然这种麻烦是因为知识匮乏导致的. 记录下避免一段时间后自己又 ...

  5. Js调用Android回调处理

    通常在混合app中经常会使用js调用native的方法,一般是: window.nativeApp.call(XXX); 直接调用native方法,对于简单的处理倒是可以,如果需要回调呢?期待的方式是 ...

  6. spring mvc json返回防止乱码

    乱码问题 乱码一直是编程的常见问题,spring mvc 返回json数据时可能导致乱码,需要在controller中添加如下代码: @RequestMapping("/test" ...

  7. jenkins 流水线学习

    最佳实践: https://www.cnblogs.com/itech/p/5678643.html 一些样例 https://jenkins.io/doc/pipeline/examples/ gi ...

  8. 相机测试camera报告的问题

    AE问题 整体偏亮 整体偏暗 高光过爆 暗处过暗 对比度低/高 亮度: 关注暗处过暗 高光过爆   对比度: 关注头发,衣服 对比度低照片会有好像一层薄薄的,发蒙 关注植物,会有灰色的 AWB问题 偏 ...

  9. IndexDB

    参考:http://www.ruanyifeng.com/blog/2018/07/indexeddb.html   cookie localStorage IndexedDB 大小 不超过4KB 2 ...

  10. Django操作cookie实例

     cookie项目文件: templates模板: login.html {% load static %} <!DOCTYPE html> <html lang="en& ...