Linux主机时钟同步-NTP操作步骤

写在文章开头,对于内网主机(无法联网)一般都是采用NTP的方式来做时做时钟同步。下面就NTP作为解决方案来介绍一下相关操作步骤。

一、简版

1、NTP服务器主机 (192.168.23.123)

  1. 安装:yum install ntp -y ;
  2. vi /etc/ntp.conf,增加配置:server 127.127.1.0 ;fudge 127.127.1.0 stratum 8;
  3. sudo service ntpd start;
  4. sudo systemctl enable ntpd.service;

对于内网主机,请确认是否有本地yum源,否则无法安装成功,主机本地yum源所在位置:/etc/yum.repos.d

2、非服务器主机

  1. 手工同步:ntpdate -d 192.168.23.123;
  2. 定时任务:0 * * * * ntpdate 192.168.23.123;(crontab 每分钟同步一次)

以上两步可以完成,内网Linux主机的时钟同步问题!

二、详细操作

1、NTP服务器主机 (192.168.23.123)

  • 安装:yum install ntp -y ;
[root@h1i5 ~]# yum install ntp ntpdate -y
Loaded plugins: fastestmirror, langpacks
Repository HDP-UTILS-1.1.0.21 is listed more than once in the configuration
HDP-2.5                                                                                                                                          | 2.9 kB  00:00:00     
HDP-2.5.3.0                                                                                                                                      | 2.9 kB  00:00:00     
HDP-UTILS-1.1.0.21                                                                                                                               | 2.9 kB  00:00:00     
ambari-2.4.x                                                                                                                                     | 2.9 kB  00:00:00     
centos74                                                                                                                                         | 3.6 kB  00:00:00     
Determining fastest mirrors
Package ntpdate-4.2.6p5-25.el7.centos.2.x86_64 already installed and latest version
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-25.el7.centos.2 will be installed
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-25.el7.centos.2.x86_64
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================</
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值