CentOS6安装使用ntp同步时间
[root@server yum.repos.d]# yum install ntp
已加载插件:fastestmirror, priorities, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
* epel: ftp.iij.ad.jp
解决依赖关系
--> 执行事务检查
---> Package ntp.x86_64 0:4.2.6p5-10.el6.centos.2 will be 升级
---> Package ntp.x86_64 0:4.2.6p5-15.el6.centos will be an update
--> 处理依赖关系 ntpdate = 4.2.6p5-15.el6.centos,它被软件包 ntp-4.2.6p5-15.el6.centos.x86_64 需要
--> 执行事务检查
---> Package ntpdate.x86_64 0:4.2.6p5-10.el6.centos.2 will be 升级
---> Package ntpdate.x86_64 0:4.2.6p5-15.el6.centos will be an update
--> 完成依赖关系计算
依赖关系解决
====================================================================================================================================
软件包 架构 版本 仓库 大小
====================================================================================================================================
正在升级:
ntp x86_64 4.2.6p5-15.el6.centos updates 600 k
为依赖而更新:
ntpdate x86_64 4.2.6p5-15.el6.centos updates 79 k
事务概要
====================================================================================================================================
Upgrade 2 Package(s)
总下载量:679 k
确定吗?[y/N]:y
下载软件包:
(1/2): ntp-4.2.6p5-15.el6.centos.x86_64.rpm | 600 kB 00:01
(2/2): ntpdate-4.2.6p5-15.el6.centos.x86_64.rpm | 79 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------
总计 249 kB/s | 679 kB 00:02
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在升级 : ntpdate-4.2.6p5-15.el6.centos.x86_64 1/4
正在升级 : ntp-4.2.6p5-15.el6.centos.x86_64 2/4
清理 : ntp-4.2.6p5-10.el6.centos.2.x86_64 3/4
清理 : ntpdate-4.2.6p5-10.el6.centos.2.x86_64 4/4
Verifying : ntpdate-4.2.6p5-15.el6.centos.x86_64 1/4
Verifying : ntp-4.2.6p5-15.el6.centos.x86_64 2/4
Verifying : ntp-4.2.6p5-10.el6.centos.2.x86_64 3/4
Verifying : ntpdate-4.2.6p5-10.el6.centos.2.x86_64 4/4
更新完毕:
ntp.x86_64 0:4.2.6p5-15.el6.centos
作为依赖被升级:
ntpdate.x86_64 0:4.2.6p5-15.el6.centos
完毕!
[root@server yum.repos.d]#
[root@server ~]# ntpdate ntp.api.bz
10 Jan 18:53:58 ntpdate[11156]: adjust time server 114.118.7.161 offset 0.000293 sec
[root@server ~]# dig ntp.api.bz
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.62.rc1.el6 <<>> ntp.api.bz
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36024
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;ntp.api.bz. IN A
;; ANSWER SECTION:
ntp.api.bz. 63 IN CNAME time.phpts.com.
time.phpts.com. 63 IN CNAME ntp.ntsc.ac.cn.
ntp.ntsc.ac.cn. 644 IN A 114.118.7.163
ntp.ntsc.ac.cn. 644 IN A 114.118.7.161
;; Query time: 31 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Mon Jan 10 18:54:03 2022
;; MSG SIZE rcvd: 116
[root@server ~]# crontab -l
*/5 * * * * /usr/sbin/ntpdate ntp.api.bz>>/dev/null 2>&1
[root@server ~]#
本文来自博客园,作者:花之旭,转载请注明原文链接:https://www.cnblogs.com/huazhixu/p/15785600.html