Linuk离线安装安装ntp服务和ntpdate

Linuk离线安装安装ntp服务和ntpdate

手动同步ntpdate

设置时区:
查看是否存在:timedatectl list-timezones |grep Asia/Sahnghai
设置:timedatectl set-timezones |grep Asia/Sahnghai

查看时区
date -R +0800

ntpdate ip 同步时区


相关安装包:

https://pan.baidu.com/s/1oiXWqfrZ7xQCxCe7fDX0CQ
提取码:SMZH

还可以在下载:
https://pkgs.org/download/ntp

ntp自动同步

安装ntpq服务

1.查询主机Linux系统版本

cat /etc/redhat-release

安装这个包

rpm -ivh ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm

提示缺少依赖 :

libedit.so.25
ntpdate-4.2.6p5-29.el7.centos.2.x86_64

安装这个包(libedit.so.25)

rpm -ivh autogen-libopts-5.18-5.el7.x86_64.rpm

安装这个包(ntpdate),安装前需要检查服务是否存在

rpm -qa | grep ntpdate(存在删掉即可)

删除:

yum remove ntpdate -y

在安装

rpm -ivh  ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm

最后执行安装ntp

rpm -ivh ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm        

配置 NTP时间同步源

vi /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 172.17.100.8 #指定NTP服务器地址

重启

systemctl restart ntpd

查看服务是否运行

ps -ef |grep ntpd

测试是否成功

ntpstat

出现失败,需要等待大约2-3分钟左右

unsynchronised
  time server re-starting
   polling server every 8 s

再执行ntpstat出现成功

synchronised to NTP server (172.17.100.8) at stratum 7
   time correct to within 951 ms
   polling server every 64 s
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值